MCPcopy Create free account
hub / github.com/PageAI-Pro/page-ui / CopyThemeCode

Function CopyThemeCode

components/bricks/theme/copy-theme-code.tsx:191–307  ·  view source on GitHub ↗
({
  className = '',
  fonts,
  themeObject,
}: {
  className?: string;
  fonts: {
    default: FontDefinition;
    display: FontDefinition;
  };
  themeObject: ColorThemeObject;
})

Source from the content-addressed store, hash-verified

189};
190
191export const CopyThemeCode = ({
192 className = '',
193 fonts,
194 themeObject,
195}: {
196 className?: string;
197 fonts: {
198 default: FontDefinition;
199 display: FontDefinition;
200 };
201 themeObject: ColorThemeObject;
202}) => {
203 const [copyType, setCopyType] = useState(COPY_TYPES.NEXTJS);
204
205 return (
206 <div className={cn('flex-col', className)}>
207 <Dialog>
208 <DialogTrigger asChild>
209 <Button
210 variant="default"
211 size="sm"
212 className={cn('relative flex gap-1', className)}
213 >
214 <CopyIcon className="h-3 w-3 mr-1" />
215 <span>Copy</span>
216 </Button>
217 </DialogTrigger>
218 <DialogContent className="md:max-w-2xl lg:max-w-2xl">
219 <DialogHeader>
220 <DialogTitle>Copy code</DialogTitle>
221 <DialogDescription>
222 Used fonts:{' '}
223 <span className="font-semibold">{fonts.default.name}</span>
224 {fonts.default.name !== fonts.display.name ? (
225 <span className="font-semibold">, {fonts.display.name}</span>
226 ) : null}
227 <br />
228 Closest TailwindCSS colors:{' '}
229 <span className="font-semibold">
230 {themeObject.tailwindNames.primary}
231 </span>
232 <span className="font-semibold">
233 , {themeObject.tailwindNames.secondary}
234 </span>
235 </DialogDescription>
236 </DialogHeader>
237
238 <div className="overflow-auto">
239 <Tabs
240 defaultValue={copyType}
241 onValueChange={(tabId: string) => {
242 setCopyType(tabId);
243 }}
244 >
245 <TabsList className="w-full flex md:grid md:grid-cols-4 justify-start overflow-x-auto overflow-y-hidden mt-4">
246 <TabsTrigger value={COPY_TYPES.NEXTJS}>
247 Shipixen / Next.js
248 </TabsTrigger>

Callers

nothing calls this directly

Calls 1

cnFunction · 0.90

Tested by

no test coverage detected