Improve Button docs

Signed-off-by: Charles de Dreuille <charles.dedreuille@gmail.com>
This commit is contained in:
Charles de Dreuille
2024-12-07 23:05:01 +00:00
parent 9f9841a8a2
commit eb459c8bd6
3 changed files with 71 additions and 1 deletions
@@ -0,0 +1,21 @@
/*
* Copyright 2024 The Backstage Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
export const Canvas = props => {
console.log(props);
return <div>Canvas</div>;
};
@@ -26,7 +26,6 @@ const meta = {
parameters: {
layout: 'centered',
},
tags: ['autodocs'],
argTypes: {
size: {
control: 'select',
@@ -0,0 +1,50 @@
import { Canvas, Meta, Unstyled, Source } from '@storybook/blocks';
import * as ButtonStories from './Button.stories';
import { Title, Text } from '../../../docs/components';
import { PropsTable } from '../../../docs/components/PropsTable';
<Meta of={ButtonStories} />
<Unstyled>
<Title type="h1">Button</Title>
<Text>A button component that can be used to trigger actions.</Text>
<Canvas of={ButtonStories.Primary} />
<Source of={ButtonStories.Primary} dark />
<Title type="h2" style={{ marginBottom: '16px' }}>
API reference
</Title>
<PropsTable
data={{
size: {
type: ['small', 'medium'],
responsive: false,
},
variant: {
type: ['primary', 'secondary', 'tertiary'],
responsive: false,
},
disabled: {
type: 'boolean',
responsive: false,
},
children: {
type: 'ReactNode',
responsive: false,
},
className: {
type: 'string',
responsive: false,
},
style: {
type: 'CSSProperties',
responsive: false,
},
}}
/>
</Unstyled>