11import type { FC } from 'react' ;
2+ import { useRef } from 'react' ;
23import { Button , CloseButton , LinkButton } from '../../../src/tailwind' ;
34
5+ const ButtonsWithRefs : FC = ( ) => {
6+ const linkButtonRef = useRef < HTMLButtonElement > ( null ) ;
7+ const closeButtonRef = useRef < HTMLButtonElement > ( null ) ;
8+ const regularButtonRef = useRef < HTMLButtonElement > ( null ) ;
9+ const buttonWithLinkRef = useRef < HTMLAnchorElement > ( null ) ;
10+
11+ return (
12+ < div className = "tw:flex tw:flex-col tw:gap-y-2" >
13+ < h2 > Buttons with ref</ h2 >
14+ < div className = "tw:flex tw:gap-x-2" >
15+ < LinkButton ref = { linkButtonRef } > Link button</ LinkButton >
16+ < CloseButton ref = { closeButtonRef } />
17+ < Button ref = { regularButtonRef } > Regular button</ Button >
18+ < Button to = "" ref = { buttonWithLinkRef } > Button with link</ Button >
19+ </ div >
20+ </ div >
21+ ) ;
22+ } ;
23+
424export const ButtonsPage : FC = ( ) => {
525 return (
626 < div className = "tw:flex tw:flex-col tw:gap-y-4" >
@@ -12,6 +32,7 @@ export const ButtonsPage: FC = () => {
1232 < Button variant = "danger" > Danger</ Button >
1333 </ div >
1434 </ div >
35+
1536 < div className = "tw:flex tw:flex-col tw:gap-y-2" >
1637 < h2 > Button sizes</ h2 >
1738 < div className = "tw:flex tw:gap-x-2" >
@@ -25,6 +46,7 @@ export const ButtonsPage: FC = () => {
2546 < Button variant = "danger" size = "lg" > Danger</ Button >
2647 </ div >
2748 </ div >
49+
2850 < div className = "tw:flex tw:flex-col tw:gap-y-2" >
2951 < h2 > Solid buttons</ h2 >
3052 < div className = "tw:flex tw:gap-x-2" >
@@ -33,6 +55,7 @@ export const ButtonsPage: FC = () => {
3355 < Button variant = "danger" solid > Danger</ Button >
3456 </ div >
3557 </ div >
58+
3659 < div className = "tw:flex tw:flex-col tw:gap-y-2" >
3760 < h2 > Disabled buttons</ h2 >
3861 < div className = "tw:flex tw:gap-x-2" >
@@ -46,6 +69,7 @@ export const ButtonsPage: FC = () => {
4669 < Button variant = "danger" solid disabled > Danger</ Button >
4770 </ div >
4871 </ div >
72+
4973 < div className = "tw:flex tw:flex-col tw:gap-y-2" >
5074 < h2 > Others</ h2 >
5175 < div className = "tw:flex tw:gap-x-2" >
@@ -55,6 +79,8 @@ export const ButtonsPage: FC = () => {
5579 < Button to = "" > Button with link</ Button >
5680 </ div >
5781 </ div >
82+
83+ < ButtonsWithRefs />
5884 </ div >
5985 ) ;
6086} ;
0 commit comments