@@ -12,9 +12,11 @@ type Story = StoryObj<typeof Button>;
1212
1313type AllButtonsProps = ButtonProps & {
1414 color : ButtonProps [ "color" ] ;
15+ asLink ?: boolean ;
1516} ;
1617
17- const AllButtons = ( { color = "brand" } : AllButtonsProps ) => {
18+ const AllButtons = ( { color = "brand" , asLink = false } : AllButtonsProps ) => {
19+ const href = asLink ? "#" : undefined ;
1820 return (
1921 < div
2022 style = { {
@@ -34,23 +36,23 @@ const AllButtons = ({ color = "brand" }: AllButtonsProps) => {
3436 } }
3537 >
3638 < h4 className = { `clr-content-semantic-${ color } -primary` } > Primary</ h4 >
37- < Button { ...Primary . args } color = { color } />
38- < Button { ...PrimaryDisabled . args } color = { color } />
39+ < Button { ...Primary . args } color = { color } href = { href } />
40+ < Button { ...PrimaryDisabled . args } color = { color } href = { href } />
3941 </ div >
4042 < div style = { { display : "flex" , flexDirection : "column" , gap : "1rem" } } >
4143 < h4 className = { `clr-content-semantic-${ color } -primary` } > Secondary</ h4 >
42- < Button { ...Secondary . args } color = { color } />
43- < Button { ...SecondaryDisabled . args } color = { color } />
44+ < Button { ...Secondary . args } color = { color } href = { href } />
45+ < Button { ...SecondaryDisabled . args } color = { color } href = { href } />
4446 </ div >
4547 < div style = { { display : "flex" , flexDirection : "column" , gap : "1rem" } } >
4648 < h4 className = { `clr-content-semantic-${ color } -primary` } > Tertiary</ h4 >
47- < Button { ...BrandTertiary . args } color = { color } />
48- < Button { ...TertiaryDisabled . args } color = { color } />
49+ < Button { ...BrandTertiary . args } color = { color } href = { href } />
50+ < Button { ...TertiaryDisabled . args } color = { color } href = { href } />
4951 </ div >
5052 < div style = { { display : "flex" , flexDirection : "column" , gap : "1rem" } } >
5153 < h4 className = { `clr-content-semantic-${ color } -primary` } > Bordered</ h4 >
52- < Button { ...Bordered . args } color = { color } />
53- < Button { ...BrandBorderedDisabled . args } color = { color } />
54+ < Button { ...Bordered . args } color = { color } href = { href } />
55+ < Button { ...BrandBorderedDisabled . args } color = { color } href = { href } />
5456 </ div >
5557 </ div >
5658 ) ;
@@ -226,12 +228,7 @@ export const IconOnly: Story = {
226228} ;
227229
228230export const AsLink : Story = {
229- args : {
230- children : "Go to fun-mooc.fr" ,
231- icon : < span className = "material-icons" > link</ span > ,
232- variant : "primary" ,
233- href : "https://www.fun-mooc.fr/" ,
234- target : "_blank" ,
235- rel : "noopener noreferrer" ,
231+ render : ( ) => {
232+ return < AllButtons color = "brand" asLink /> ;
236233 } ,
237234} ;
0 commit comments