63 lines
2.8 KiB
TypeScript
63 lines
2.8 KiB
TypeScript
import React, { useState } from 'react'
|
|
import { showToast } from '../../../components/feedback/Toast'
|
|
|
|
export const WorkspaceSelector: React.FC<{ isProjectList?: boolean }> = ({ isProjectList = false }) => {
|
|
const [open, setOpen] = useState(false)
|
|
|
|
return (
|
|
<div className="relative">
|
|
<button
|
|
type="button"
|
|
onClick={() => setOpen((prev) => !prev)}
|
|
className={`w-full flex items-center justify-between bg-white text-left transition-colors ${isProjectList ? 'gap-[9px] rounded-[8px] border border-[#344057] p-2.5 hover:border-[#344057]' : 'rounded-xl border border-slate-300/90 px-3 py-2.5 hover:border-slate-400'}`}
|
|
>
|
|
<div className="flex items-center gap-2.5 min-w-0">
|
|
<div className={`flex h-8 w-8 shrink-0 items-center justify-center text-[11px] font-semibold text-[#332926] ${isProjectList ? 'h-7 w-7 rounded-[6px] bg-[#d6dae6]' : 'rounded-full bg-indigo-50 text-slate-700'}`}>
|
|
VL
|
|
</div>
|
|
<div className="min-w-0">
|
|
<div className={`truncate font-semibold leading-tight ${isProjectList ? 'text-[13px] text-[#332926]' : 'text-sm text-slate-900'}`}>
|
|
danable
|
|
</div>
|
|
<div className={`truncate mt-0.5 ${isProjectList ? 'text-[10px] text-[#332926]' : 'text-[11px] text-slate-500'}`}>
|
|
Không gian nhóm
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{isProjectList ? (
|
|
<img className="h-[13px] w-[13px] shrink-0" src="/assets/projects-ui/chevrons-up-down.svg" alt="" />
|
|
) : (
|
|
<svg className="h-4 w-4 shrink-0 text-slate-400" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth={1.8}>
|
|
<path strokeLinecap="round" strokeLinejoin="round" d="M8 9l4-4 4 4m0 6l-4 4-4-4" />
|
|
</svg>
|
|
)}
|
|
</button>
|
|
|
|
{open && (
|
|
<div className="absolute left-0 right-0 z-30 mt-1.5 rounded-xl border border-slate-200 bg-white p-1.5 shadow-lg">
|
|
<button
|
|
type="button"
|
|
onClick={() => {
|
|
setOpen(false)
|
|
showToast.info('Đang ở Không gian nhóm danable')
|
|
}}
|
|
className="flex w-full items-center justify-between rounded-lg bg-slate-50 px-2.5 py-2 text-xs font-medium text-slate-800"
|
|
>
|
|
<span>danable (Không gian nhóm)</span>
|
|
<span className="text-[#C95C3C] font-bold">✓</span>
|
|
</button>
|
|
<button
|
|
type="button"
|
|
onClick={() => {
|
|
setOpen(false)
|
|
showToast.info('Đã chuyển sang Không gian cá nhân')
|
|
}}
|
|
className="mt-0.5 flex w-full items-center justify-between rounded-lg px-2.5 py-2 text-xs text-slate-600 hover:bg-slate-50"
|
|
>
|
|
<span>VisionLab R&D</span>
|
|
</button>
|
|
</div>
|
|
)}
|
|
</div>
|
|
)
|
|
}
|