Skip to content

Commit bc8ddea

Browse files
BillLeoutsakosvl346Bill Leoutsakos
andauthored
improvement(ui): reuse the shared branding upload drop zone (#8031)
Co-authored-by: Bill Leoutsakos <billleoutsakos@Bills-MacBook-Pro.local>
1 parent 5b60a9e commit bc8ddea

1 file changed

Lines changed: 1 addition & 36 deletions

File tree

‎apps/sim/ee/whitelabeling/components/whitelabeling-settings.tsx‎

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { isEnterprise } from '@/lib/billing/plan-helpers'
1111
import { HEX_COLOR_REGEX } from '@/lib/branding'
1212
import type { OrganizationWhitelabelSettings } from '@/lib/branding/types'
1313
import { useDeploymentShape } from '@/lib/core/config/deployment-shape'
14+
import { DropZone } from '@/app/workspace/[workspaceId]/components/drop-zone'
1415
import { SettingsEmptyState } from '@/app/workspace/[workspaceId]/settings/components/settings-empty-state'
1516
import { SettingsPanel } from '@/app/workspace/[workspaceId]/settings/components/settings-panel'
1617
import { SettingsSection } from '@/app/workspace/[workspaceId]/settings/components/settings-section/settings-section'
@@ -27,42 +28,6 @@ import { useWorkspacesQuery } from '@/hooks/queries/workspace'
2728

2829
const logger = createLogger('WhitelabelingSettings')
2930

30-
interface DropZoneProps {
31-
onDrop: (e: React.DragEvent) => void
32-
children: React.ReactNode
33-
className?: string
34-
}
35-
36-
function DropZone({ onDrop, children, className }: DropZoneProps) {
37-
const [isDragging, setIsDragging] = useState(false)
38-
39-
return (
40-
<div
41-
className={cn('relative', className)}
42-
onDragOver={(e) => {
43-
if (e.dataTransfer.types.includes('Files')) {
44-
e.preventDefault()
45-
setIsDragging(true)
46-
}
47-
}}
48-
onDragLeave={(e) => {
49-
if (!e.currentTarget.contains(e.relatedTarget as Node)) {
50-
setIsDragging(false)
51-
}
52-
}}
53-
onDrop={(e) => {
54-
setIsDragging(false)
55-
onDrop(e)
56-
}}
57-
>
58-
{children}
59-
{isDragging && (
60-
<div className='pointer-events-none absolute inset-0 z-10 rounded-lg border-[1.5px] border-[var(--brand-accent)] border-dashed bg-[color-mix(in_srgb,var(--brand-accent)_8%,transparent)]' />
61-
)}
62-
</div>
63-
)
64-
}
65-
6631
interface ColorInputProps {
6732
label: string
6833
value: string

0 commit comments

Comments
 (0)