mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-10 00:12:22 +08:00
In 6.5 the `framework` config option was one of `react`, `angular`, etc. and included Webpack settings. In the 7.0, we’ve updated it so that these are now called `renderers`, and are builder-independent. Now, frameworks contain specific builder information, such as `cra` or `nextjs` (for specific app environments) or `react-webpack5` / `react-vite` (for custom apps). This fixes the `sb init` CLI command to use renderer-specific templates. I also call out some follow-up work to fix automigrations & telemetry
49 lines
924 B
TypeScript
49 lines
924 B
TypeScript
import React from 'react';
|
|
import './button.css';
|
|
|
|
interface ButtonProps {
|
|
/**
|
|
* Is this the principal call to action on the page?
|
|
*/
|
|
primary?: boolean;
|
|
/**
|
|
* What background color to use
|
|
*/
|
|
backgroundColor?: string;
|
|
/**
|
|
* How large should the button be?
|
|
*/
|
|
size?: 'small' | 'medium' | 'large';
|
|
/**
|
|
* Button contents
|
|
*/
|
|
label: string;
|
|
/**
|
|
* Optional click handler
|
|
*/
|
|
onClick?: () => void;
|
|
}
|
|
|
|
/**
|
|
* Primary UI component for user interaction
|
|
*/
|
|
export const Button = ({
|
|
primary = false,
|
|
size = 'medium',
|
|
backgroundColor,
|
|
label,
|
|
...props
|
|
}: ButtonProps) => {
|
|
const mode = primary ? 'storybook-button--primary' : 'storybook-button--secondary';
|
|
return (
|
|
<button
|
|
type="button"
|
|
className={['storybook-button', `storybook-button--${size}`, mode].join(' ')}
|
|
style={{ backgroundColor }}
|
|
{...props}
|
|
>
|
|
{label}
|
|
</button>
|
|
);
|
|
};
|