File size: 1,405 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import React from 'react';
import { Button } from './storybook-utils/typed-wp-components';
import type { Meta, StoryObj } from '@storybook/react';

// Not using a relative path here to ensure that the build is working.
import '@automattic/components/styles/wp-button-override.scss';

/**
 * This reference is for A8C-specific style overrides for the `Button` component from `@wordpress/components`.
 *
 * See the [WordPress Storybook](https://wordpress.github.io/gutenberg/?path=/docs/components-button--docs) docs for more information.
 */
const meta: Meta< typeof Button > = {
	title: 'WP Overrides/Button',
	component: Button,
	decorators: [
		( Story ) => (
			<div style={ { fontFamily: 'sans-serif' } }>
				<Story />
			</div>
		),
	],
};

export default meta;
type Story = StoryObj< typeof Button >;

export const Default: Story = {
	args: {
		children: 'Button',
		__next40pxDefaultSize: true,
		accessibleWhenDisabled: true,
	},
};

/**
 * The secondary button styles can be overridden to the A8C styles by adding the
 * `.a8c-components-wp-button` class.
 *
 * To load these styles, import the `@automattic/components/styles/wp-button-override.scss` file
 * somewhere in your project.
 */
export const Secondary: Story = {
	args: {
		...Default.args,
		variant: 'secondary',
		className: 'a8c-components-wp-button',
	},
	parameters: {
		docs: {
			canvas: { sourceState: 'shown' },
		},
	},
};