-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
10 changed files
with
130 additions
and
6 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
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,37 @@ | ||
import React, { ReactNode } from 'react'; | ||
|
||
import { Dialog } from '@headlessui/react'; | ||
|
||
import clsx from 'clsx'; | ||
|
||
export interface PlaceholderProps { | ||
/** | ||
* Custom classes for the placeholder | ||
*/ | ||
className?: string; | ||
/** | ||
* The width of the placeholder | ||
*/ | ||
width?: 0 | 1 | 2 | 3 | 4 | 5 | 25 | 50 | 75 | 100 | 'auto'; | ||
} | ||
|
||
/** | ||
* Primary UI component for user interaction | ||
*/ | ||
export const Placeholder = ({ | ||
width, | ||
className | ||
}: PlaceholderProps) => { | ||
return ( | ||
<span | ||
className={clsx( | ||
'placeholder', | ||
'me-1', | ||
`w-${width}`, | ||
className | ||
)} | ||
/> | ||
); | ||
}; | ||
|
||
export default Placeholder; |
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,2 @@ | ||
export { default } from './Placeholder'; | ||
export type { PlaceholderProps } from './Placeholder'; |
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 |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { useState } from "react"; | ||
|
||
import DemoBox from "@docs/components/DemoBox"; | ||
|
||
import { | ||
Button, | ||
Card, | ||
CardBody, | ||
CardTitle, | ||
Grid, | ||
Placeholder, | ||
} from "@components"; | ||
|
||
export default function PlaceholderDemo() { | ||
const [open, setOpen] = useState(false); | ||
|
||
return ( | ||
<> | ||
<h2>Placeholder</h2> | ||
<DemoBox> | ||
<Grid> | ||
<Card className="me-2" aria-hidden="true" style={{ width: 240 }}> | ||
<CardBody> | ||
<CardTitle> | ||
Hello card | ||
</CardTitle> | ||
<p> | ||
What an <span className="text-accent">beautiful</span> day for a fully loaded card of content, isn't it? | ||
</p> | ||
<Button href="#" variant="primary">Get started</Button> | ||
</CardBody> | ||
</Card> | ||
<Card className="me-2" aria-hidden="true" style={{ width: 240 }}> | ||
<CardBody> | ||
<CardTitle> | ||
<Placeholder width={5} /> | ||
</CardTitle> | ||
<p> | ||
<Placeholder width={3} /> | ||
<span className="text-accent"><Placeholder width={4} /></span> | ||
<Placeholder width={4} /> | ||
<Placeholder width={5} /> | ||
<Placeholder width={2} /> | ||
</p> | ||
<Button href="#" variant="primary" placeholderWidth={5}>Get started</Button> | ||
</CardBody> | ||
</Card> | ||
</Grid> | ||
</DemoBox> | ||
</> | ||
); | ||
} |
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