Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use icon to indicate exported #2614

Merged
merged 1 commit into from
Sep 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions frontend/console/src/features/modules/ModulesTree.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
CircleArrowRight02Icon,
CodeIcon,
DatabaseIcon,
FileExportIcon,
FlowIcon,
FunctionIcon,
type HugeiconsProps,
Expand All @@ -22,8 +23,7 @@ import { classNames } from '../../utils'
import type { ModuleTreeItem } from './module.utils'
import { addModuleToLocalStorageIfMissing, listExpandedModulesFromLocalStorage, toggleModuleExpansionInLocalStorage } from './module.utils'

// This could alternatively be an icon, but we'd need to pick a good one.
const ExportBadge = () => <span className='text-xs py-0.5 px-1.5 bg-gray-200 dark:bg-gray-800 dark:text-gray-300 rounded-md'>Exported</span>
const ExportedIcon = () => <FileExportIcon className='size-4 text-indigo-500 -ml-1' />

type IconMap = Record<string, React.FC<Omit<HugeiconsProps, 'ref'> & React.RefAttributes<SVGSVGElement>>>
const icons: IconMap = {
Expand Down Expand Up @@ -62,7 +62,7 @@ const DeclNode = ({ decl, href, isSelected }: { decl: Decl; href: string; isSele
>
<Icon aria-hidden='true' className='size-4 shrink-0' />
{decl.value.value.name}
{(decl.value.value as WithExport).export === true ? <ExportBadge /> : []}
{(decl.value.value as WithExport).export === true ? <ExportedIcon /> : []}
</div>
</li>
)
Expand Down
Loading