forked from tajo/ladle
-
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
27 changed files
with
629 additions
and
312 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Large diffs are not rendered by default.
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
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,54 +1,63 @@ | ||
import Tooltip from "@reach/tooltip"; | ||
import * as React from "react"; | ||
import { Ladle } from "../icons"; | ||
import { Modal, Code } from "../ui"; | ||
|
||
export const Button: React.FC<{}> = () => { | ||
const [open, setOpen] = React.useState(false); | ||
const text = "Get more information about Ladle."; | ||
const [isOpen, setIsOpen] = React.useState(false); | ||
const handleButtonClick = () => { | ||
setIsOpen((prevState) => !prevState); | ||
}; | ||
|
||
return ( | ||
<li> | ||
<button | ||
aria-label={text} | ||
title={text} | ||
onClick={() => setOpen(true)} | ||
className={open ? "ladle-active" : ""} | ||
> | ||
<Ladle /> | ||
<span className="ladle-addon-tooltip">{text}</span> | ||
<label>About Ladle</label> | ||
<Modal | ||
isOpen={open} | ||
close={() => setOpen(false)} | ||
label="Dialog with information about Ladle." | ||
<Tooltip label="Get more information about Ladle"> | ||
<button | ||
type="button" | ||
onClick={handleButtonClick} | ||
data-active={isOpen || undefined} | ||
> | ||
<p> | ||
Ladle is a modern and very fast playground for React components | ||
powered by Vite. For more information: | ||
<Ladle /> | ||
<Modal | ||
title={ | ||
<> | ||
<Ladle /> | ||
About Ladle | ||
</> | ||
} | ||
isOpen={isOpen} | ||
close={() => setIsOpen(false)} | ||
label="Dialog with information about Ladle." | ||
> | ||
<p> | ||
Ladle is a modern and very fast playground for React components | ||
powered by Vite. For more information: | ||
<ul> | ||
<li> | ||
<a href="https://www.ladle.dev/">Ladle.dev</a> | ||
</li> | ||
<li> | ||
<a href="https://github.com/tajo/ladle">GitHub</a> | ||
</li> | ||
<li> | ||
<a href="https://node.new/ladle">StackBlitz</a> | ||
</li> | ||
<li> | ||
<a href="https://discord.gg/H6FSHjyW7e">Discord</a> | ||
</li> | ||
</ul> | ||
</p> | ||
<p> | ||
<strong>Shortcuts</strong> | ||
</p> | ||
<ul> | ||
<li> | ||
<a href="https://www.ladle.dev/">Ladle.dev</a> | ||
</li> | ||
<li> | ||
<a href="https://github.com/tajo/ladle">GitHub</a> | ||
</li> | ||
<li> | ||
<a href="https://node.new/ladle">StackBlitz</a> | ||
</li> | ||
<li> | ||
<a href="https://discord.gg/H6FSHjyW7e">Discord</a> | ||
<Code>/</Code> or <Code>cmd+p</Code> - search stories | ||
</li> | ||
</ul> | ||
</p> | ||
<p> | ||
<strong>Shortcuts</strong> | ||
</p> | ||
<ul> | ||
<li> | ||
<Code>/</Code> or <Code>cmd+p</Code> - search stories | ||
</li> | ||
</ul> | ||
</Modal> | ||
</button> | ||
</Modal> | ||
</button> | ||
</Tooltip> | ||
</li> | ||
); | ||
}; |
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
Oops, something went wrong.