-
Notifications
You must be signed in to change notification settings - Fork 131
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
c861066
commit 4da3a41
Showing
1 changed file
with
38 additions
and
0 deletions.
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
packages/react-ui/components/__stories__/sandbox.stories.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,38 @@ | ||
import React, { useEffect, useRef, useState } from 'react'; | ||
|
||
import { Meta } from '../../typings/stories'; | ||
import { Tooltip } from '../Tooltip'; | ||
import { Hint } from '../Hint'; | ||
import { Gapped } from '../Gapped'; | ||
import { WidgetContainer } from '../../lib/widgets'; | ||
|
||
export default { | ||
title: 'Sandbox', | ||
} as Meta; | ||
|
||
export const Default = () => { | ||
const root = useRef<HTMLDivElement>(null); | ||
const [_, forceUpdate] = useState<number>(); | ||
|
||
useEffect(() => forceUpdate(Date.now), [root.current]); | ||
|
||
return ( | ||
<div style={{ position: 'relative', overflow: 'hidden' }}> | ||
<div ref={root} /> | ||
{root.current && ( | ||
<WidgetContainer root={root.current}> | ||
<div style={{ padding: '100px 0' }}> | ||
<Gapped vertical gap={60}> | ||
<Tooltip pos="right middle" trigger="opened" render={() => <div>Tooltip</div>}> | ||
<div>Tooltip</div> | ||
</Tooltip> | ||
<Hint pos="right middle" manual opened text="Hint"> | ||
<div>Hint</div> | ||
</Hint> | ||
</Gapped> | ||
</div> | ||
</WidgetContainer> | ||
)} | ||
</div> | ||
); | ||
}; |