-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0afb3bb
commit 9d97ec1
Showing
46 changed files
with
652 additions
and
213 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@frontify/fondue-icons": patch | ||
--- | ||
|
||
Generate React components |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,11 @@ | ||
/* (c) Copyright Frontify Ltd., all rights reserved. */ | ||
|
||
import { usePageContext } from 'vike-react/usePageContext'; | ||
|
||
import { MdxContent } from '../../components/MdxContent'; | ||
|
||
export const Page = () => { | ||
const { data } = usePageContext(); | ||
|
||
if (!data) { | ||
return <h1 className="tw-text-3xl tw-font-bold tw-mb-8">Components</h1>; | ||
} | ||
|
||
return ( | ||
<> | ||
<h1 className="tw-text-3xl tw-font-bold tw-mb-8">{data.component.title}</h1> | ||
<MdxContent data={data.component.body.code} /> | ||
</> | ||
<div className="tw-p-8 tw-w-full tw-flex tw-justify-center"> | ||
<div className="tw-max-w-[856px] tw-w-full"> | ||
<h1 className="tw-text-3xl tw-font-bold">Components</h1> | ||
</div> | ||
</div> | ||
); | ||
}; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* (c) Copyright Frontify Ltd., all rights reserved. */ | ||
|
||
import { usePageContext } from 'vike-react/usePageContext'; | ||
|
||
import { MdxContent } from '../../../components/MdxContent'; | ||
|
||
export const Page = () => { | ||
const { data } = usePageContext(); | ||
|
||
if (!data) { | ||
return <h1 className="tw-text-3xl tw-font-bold tw-mb-8">Components</h1>; | ||
} | ||
|
||
return ( | ||
<> | ||
<div className="tw-p-8 tw-w-full tw-flex tw-justify-center"> | ||
<div className="tw-max-w-[856px] tw-w-full"> | ||
<h1 className="tw-text-3xl tw-font-bold tw-mb-8">{data.component.title}</h1> | ||
<MdxContent data={data.component.body.code} /> | ||
</div> | ||
</div> | ||
<aside className="tw-p-8 2xl:tw-flex tw-hidden tw-flex-col tw-w-72 tw-shrink-0"> | ||
<span className="tw-text-lg tw-font-bold">Table of content</span> | ||
</aside> | ||
</> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
docs/src/pages/components/@componentId/+onBeforePrerenderStart.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/* (c) Copyright Frontify Ltd., all rights reserved. */ | ||
|
||
import { allComponents } from '#contentlayer/generated'; | ||
|
||
export const onBeforePrerenderStart = (): string[] => { | ||
return allComponents.map((component) => `/components/${component.route}`); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* (c) Copyright Frontify Ltd., all rights reserved. */ | ||
|
||
import { type ReactNode } from 'react'; | ||
|
||
import { Layout as RootLayout } from '../+Layout'; | ||
|
||
export const Layout = ({ children }: { children: ReactNode }) => { | ||
return ( | ||
<RootLayout> | ||
<div className="tw-h-full tw-flex tw-w-full"> | ||
<div className="tw-p-8 tw-w-full tw-flex tw-justify-center"> | ||
<div className="tw-max-w-[856px] tw-w-full">{children}</div> | ||
</div> | ||
</div> | ||
</RootLayout> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,31 @@ | ||
/* (c) Copyright Frontify Ltd., all rights reserved. */ | ||
|
||
import { icons } from '@frontify/fondue-icons'; | ||
|
||
import { kebabCase } from '../../utilities/kebabCase'; | ||
|
||
export const Page = () => { | ||
return ( | ||
<div className="tw-p-8"> | ||
<h1 className="tw-text-3xl tw-font-bold">Icons</h1> | ||
|
||
<div className="tw-mt-8 tw-gap-8 tw-grid tw-grid-cols-[repeat(auto-fill,minmax(56px,1fr))]"> | ||
{Object.keys(icons).map((icon) => { | ||
const IconComponent = icons[icon as keyof typeof icons]; | ||
|
||
const iconPath = kebabCase(icon).replace(/^icon-/, ''); | ||
|
||
return ( | ||
<a | ||
href={`/icons/${iconPath}`} | ||
key={icon} | ||
className="tw-inline-flex tw-items-center tw-justify-center tw-aspect-square tw-rounded tw-bg-box-neutral hover:tw-bg-box-neutral-hover active:tw-bg-box-neutral-pressed" | ||
> | ||
<IconComponent /> | ||
</a> | ||
); | ||
})} | ||
</div> | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* (c) Copyright Frontify Ltd., all rights reserved. */ | ||
|
||
import { icons } from '@frontify/fondue-icons'; | ||
|
||
import { kebabCase } from '../../../utilities/kebabCase'; | ||
|
||
export const Page = () => { | ||
return ( | ||
<div className="tw-p-8"> | ||
<h1 className="tw-text-3xl tw-font-bold">Icons</h1> | ||
|
||
<div className="tw-mt-8 tw-gap-8 tw-grid tw-grid-cols-[repeat(auto-fill,minmax(56px,1fr))]"> | ||
{Object.keys(icons).map((icon) => { | ||
const IconComponent = icons[icon as keyof typeof icons]; | ||
|
||
const iconPath = kebabCase(icon).replace(/^icon-/, ''); | ||
|
||
return ( | ||
<a | ||
href={`/icons/${iconPath}`} | ||
key={icon} | ||
className="tw-inline-flex tw-items-center tw-justify-center tw-aspect-square tw-rounded tw-bg-box-neutral hover:tw-bg-box-neutral-hover active:tw-bg-box-neutral-pressed" | ||
> | ||
<IconComponent /> | ||
</a> | ||
); | ||
})} | ||
</div> | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* (c) Copyright Frontify Ltd., all rights reserved. */ | ||
|
||
import { type PageContextServer } from 'vike/types'; | ||
|
||
export type Data = Awaited<ReturnType<typeof data>>; | ||
|
||
export const data = (pageContext: PageContextServer) => { | ||
const { routeParams } = pageContext; | ||
|
||
return { iconId: routeParams.iconId }; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* (c) Copyright Frontify Ltd., all rights reserved. */ | ||
|
||
import { icons } from '@frontify/fondue-icons'; | ||
|
||
import { kebabCase } from '../../../utilities/kebabCase'; | ||
|
||
export const onBeforePrerenderStart = () => { | ||
const allIcons = Object.keys(icons); | ||
|
||
return allIcons.map((icon) => `/icons/${kebabCase(icon).replace(/^icon-/, '')}`); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/* (c) Copyright Frontify Ltd., all rights reserved. */ | ||
|
||
export const kebabCase = (value: string): string => { | ||
return value.replaceAll(/([a-z])([A-Z])/g, '$1-$2').toLowerCase(); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.