font-picker.tsx — ui Source File
Architecture documentation for font-picker.tsx, a tsx file in the ui codebase. 7 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR f1ad163c_2e56_1e83_5772_da63039f5347["font-picker.tsx"] 1d141819_425e_b5fd_4c8e_32f7c6a42cf2["react"] f1ad163c_2e56_1e83_5772_da63039f5347 --> 1d141819_425e_b5fd_4c8e_32f7c6a42cf2 80f09e68_7e3a_76ef_6b82_c72b6d39afbb["item"] f1ad163c_2e56_1e83_5772_da63039f5347 --> 80f09e68_7e3a_76ef_6b82_c72b6d39afbb f14cf7ca_f213_afc2_bc66_ebc0fb7d9834["config"] f1ad163c_2e56_1e83_5772_da63039f5347 --> f14cf7ca_f213_afc2_bc66_ebc0fb7d9834 000a4c85_90c9_57be_0014_4c8e8762dcff["lock-button"] f1ad163c_2e56_1e83_5772_da63039f5347 --> 000a4c85_90c9_57be_0014_4c8e8762dcff c97cebd0_0d39_fa69_4337_d0c1787c0b11["picker"] f1ad163c_2e56_1e83_5772_da63039f5347 --> c97cebd0_0d39_fa69_4337_d0c1787c0b11 3d93decf_c957_3d20_9f5e_e6c328cd39c2["fonts"] f1ad163c_2e56_1e83_5772_da63039f5347 --> 3d93decf_c957_3d20_9f5e_e6c328cd39c2 c27c6e95_5daf_4dd4_dc3a_add496837570["search-params"] f1ad163c_2e56_1e83_5772_da63039f5347 --> c27c6e95_5daf_4dd4_dc3a_add496837570 style f1ad163c_2e56_1e83_5772_da63039f5347 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
"use client"
import * as React from "react"
import {
Item,
ItemContent,
ItemDescription,
ItemTitle,
} from "@/registry/bases/radix/ui/item"
import { type FontValue } from "@/registry/config"
import { LockButton } from "@/app/(create)/components/lock-button"
import {
Picker,
PickerContent,
PickerGroup,
PickerRadioGroup,
PickerRadioItem,
PickerSeparator,
PickerTrigger,
} from "@/app/(create)/components/picker"
import { type Font } from "@/app/(create)/lib/fonts"
import { useDesignSystemSearchParams } from "@/app/(create)/lib/search-params"
export function FontPicker({
fonts,
isMobile,
anchorRef,
}: {
fonts: readonly Font[]
isMobile: boolean
anchorRef: React.RefObject<HTMLDivElement | null>
}) {
const [params, setParams] = useDesignSystemSearchParams()
const currentFont = React.useMemo(
() => fonts.find((font) => font.value === params.font),
[fonts, params.font]
)
return (
<div className="group/picker relative">
<Picker>
<PickerTrigger>
<div className="flex flex-col justify-start text-left">
<div className="text-muted-foreground text-xs">Font</div>
<div className="text-foreground text-sm font-medium">
{currentFont?.name}
</div>
</div>
<div
className="text-foreground pointer-events-none absolute top-1/2 right-4 flex size-4 -translate-y-1/2 items-center justify-center text-base select-none"
style={{ fontFamily: currentFont?.font.style.fontFamily }}
>
Aa
</div>
</PickerTrigger>
<PickerContent
anchor={isMobile ? anchorRef : undefined}
side={isMobile ? "top" : "right"}
align={isMobile ? "center" : "start"}
className="max-h-96 md:w-72"
>
<PickerRadioGroup
value={currentFont?.value}
onValueChange={(value) => {
setParams({ font: value as FontValue })
}}
>
<PickerGroup>
{fonts.map((font, index) => (
<React.Fragment key={font.value}>
<PickerRadioItem value={font.value}>
<Item size="xs">
<ItemContent className="gap-1">
<ItemTitle className="text-muted-foreground text-xs font-medium">
{font.name}
</ItemTitle>
<ItemDescription
style={{ fontFamily: font.font.style.fontFamily }}
>
Designers love packing quirky glyphs into test
phrases.
</ItemDescription>
</ItemContent>
</Item>
</PickerRadioItem>
{index < fonts.length - 1 && (
<PickerSeparator className="opacity-50" />
)}
</React.Fragment>
))}
</PickerGroup>
</PickerRadioGroup>
</PickerContent>
</Picker>
<LockButton
param="font"
className="absolute top-1/2 right-10 -translate-y-1/2"
/>
</div>
)
}
Domain
Subdomains
Functions
Dependencies
- config
- fonts
- item
- lock-button
- picker
- react
- search-params
Source
Frequently Asked Questions
What does font-picker.tsx do?
font-picker.tsx is a source file in the ui codebase, written in tsx. It belongs to the DesignEngine domain, PreviewSystem subdomain.
What functions are defined in font-picker.tsx?
font-picker.tsx defines 1 function(s): FontPicker.
What does font-picker.tsx depend on?
font-picker.tsx imports 7 module(s): config, fonts, item, lock-button, picker, react, search-params.
Where is font-picker.tsx in the architecture?
font-picker.tsx is located at apps/v4/app/(create)/components/font-picker.tsx (domain: DesignEngine, subdomain: PreviewSystem, directory: apps/v4/app/(create)/components).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free