mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +00:00
## Description This PR ensures that the default prettier config is used for examples and templates. This config is compatible with `prettier@3` as well (upgrading prettier is bigger change that can be a future PR). ## Changes - Updated `.prettierrc.json` in root with `"trailingComma": "es5"` (will be needed upgrading to prettier@3) - Added `examples/.prettierrc.json` with default config (this will change every example) - Added `packages/create-next-app/templates/.prettierrc.json` with default config (this will change every template) ## Related - Fixes #54402 - Closes #54409
57 lines
1.0 KiB
TypeScript
57 lines
1.0 KiB
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(
|
|
" ",
|
|
)}
|
|
{...props}
|
|
>
|
|
{label}
|
|
<style jsx>{`
|
|
button {
|
|
background-color: ${backgroundColor};
|
|
}
|
|
`}</style>
|
|
</button>
|
|
);
|
|
};
|