-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding: Code hightligher &
MarigoldProvider
(#3150)
Co-authored-by: Osama Abdul Latif <[email protected]> Co-authored-by: sarahgm <[email protected]> Co-authored-by: Sebastian Sebald <[email protected]> Co-authored-by: Osama Abdul Latif <[email protected]> Co-authored-by: Sebastian Sebald <[email protected]> Co-authored-by: sarahgm <[email protected]>
- Loading branch information
1 parent
f0484d2
commit 5a8dcb5
Showing
13 changed files
with
318 additions
and
78 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
22 changes: 22 additions & 0 deletions
22
docs/content/components/accordion/accordion-basic.demo.tsx
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,22 @@ | ||
import { Accordion, Headline, TextField } from '@marigold/components'; | ||
|
||
export default () => ( | ||
<Accordion defaultExpandedKeys={['1']}> | ||
<Accordion.Item key={1} title="Informations"> | ||
{/* just to test scroll */} | ||
<Headline level="3"> | ||
Some Lorem ipsum dolor sit amet consectetur adipisicing elit. Autem | ||
voluptatem minima hic ex ullam, asperiores quaerat quas eveniet, magnam | ||
quisquam dolores. Beatae eaque eveniet error ipsa veniam vero culpa | ||
recusandae? | ||
</Headline> | ||
<TextField label="Name" /> | ||
</Accordion.Item> | ||
<Accordion.Item key={2} title="Personal Settings"> | ||
two | ||
</Accordion.Item> | ||
<Accordion.Item key={3} title="Billing Adress"> | ||
<Headline level="3">Some Imformations</Headline> | ||
</Accordion.Item> | ||
</Accordion> | ||
); |
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { ThemeComponent, cva } from '@marigold/system'; | ||
|
||
export const Tabs: ThemeComponent<'Tabs'> = { | ||
tabs: cva('mb-4 border-b'), | ||
tab: cva([ | ||
'text-text-primary-muted aria-selected:text-text-primary px-2 py-1 font-medium', | ||
'aria-selected:border-border -m-px border-b-2 border-transparent', | ||
]), | ||
}; |
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,37 +1,36 @@ | ||
import { ReactNode } from 'react'; | ||
import { MarigoldProvider, Tabs } from './marigold'; | ||
import { type Theme } from '@marigold/system'; | ||
|
||
import { registry } from '../registry'; | ||
import { MarigoldProvider } from './marigold'; | ||
|
||
import { registry } from '@/registry'; | ||
import { useThemeSwitch } from '@/app/_components/ThemeSwitch'; | ||
export interface ComponentDemoProps { | ||
name: keyof typeof registry; | ||
source: string; | ||
children?: ReactNode; | ||
} | ||
|
||
export const ComponentDemo = ({ | ||
name, | ||
source, | ||
children, | ||
}: ComponentDemoProps) => { | ||
export const ComponentDemo = ({ name, children }: ComponentDemoProps) => { | ||
const Demo = registry[name].demo; | ||
const { current, themes } = useThemeSwitch(); | ||
|
||
return ( | ||
<div className="bg-cyan-800 p-10 text-cyan-100"> | ||
<pre> | ||
<code className="language-tsx">{source}</code> | ||
</pre> | ||
<hr /> | ||
<div data-theme={current}> | ||
<MarigoldProvider theme={(current && themes[current]) as Theme}> | ||
<div className="px-4 py-6"> | ||
<Demo /> | ||
</div> | ||
</MarigoldProvider> | ||
</div> | ||
</div> | ||
<Tabs defaultSelectedKey="preview"> | ||
<Tabs.Item key="preview" title="Preview"> | ||
<div | ||
data-theme={current} | ||
className="flex min-h-[150px] flex-col [&>*:first-child]:grid [&>*:first-child]:flex-1 [&>*:first-child]:place-items-center [&>*:first-child]:rounded-xl [&>*:first-child]:border" | ||
> | ||
<MarigoldProvider theme={(current && themes[current]) as Theme}> | ||
<div className="w-full p-4"> | ||
<Demo /> | ||
</div> | ||
</MarigoldProvider> | ||
</div> | ||
</Tabs.Item> | ||
<Tabs.Item key="code" title="Code"> | ||
{children} | ||
</Tabs.Item> | ||
</Tabs> | ||
); | ||
}; |
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,42 @@ | ||
import React from 'react'; | ||
import { Button } from '@marigold/components'; | ||
import useClipboard from 'react-use-clipboard'; | ||
|
||
interface CopyProps { | ||
codeString: string; | ||
} | ||
|
||
export const CopyButton = ({ codeString }: CopyProps) => { | ||
const [isCopied, setCopied] = useClipboard(codeString, { | ||
successDuration: 1000, | ||
}); | ||
return ( | ||
<Button | ||
variant="copy" | ||
onPress={setCopied} | ||
className="border-none p-0 outline-0" | ||
> | ||
{isCopied ? ( | ||
<svg | ||
className="h-5 w-5 fill-white" | ||
width="48" | ||
height="48" | ||
viewBox="0 0 24 24" | ||
> | ||
<path d="M8.17368 16.6154L3.19528 11.637L1.5 13.3204L8.17368 19.994L22.5 5.66772L20.8167 3.98437L8.17368 16.6154Z"></path> | ||
</svg> | ||
) : ( | ||
<svg | ||
className="h-5 w-5 fill-white" | ||
viewBox="0 0 16 16" | ||
fill="text.regular" | ||
> | ||
<path | ||
d="M8.8421 0H1.26316C0.568421 0 0 0.568421 0 1.26316V10.1053H1.26316V1.26316H8.8421V0ZM10.7368 2.52632H3.78947C3.09474 2.52632 2.52632 3.09474 2.52632 3.78947V12.6316C2.52632 13.3263 3.09474 13.8947 3.78947 13.8947H10.7368C11.4316 13.8947 12 13.3263 12 12.6316V3.78947C12 3.09474 11.4316 2.52632 10.7368 2.52632ZM10.7368 12.6316H3.78947V3.78947H10.7368V12.6316Z" | ||
fill="text.regular" | ||
/> | ||
</svg> | ||
)} | ||
</Button> | ||
); | ||
}; |
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.
5a8dcb5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
marigold-storybook – ./
marigold-storybook-marigold.vercel.app
marigold-latest.vercel.app
marigold-storybook-git-main-marigold.vercel.app
5a8dcb5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
marigold-docs – ./
marigold-docs-git-main-marigold.vercel.app
marigold-docs.vercel.app
marigold-docs-marigold.vercel.app