diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 0000000..24a0423 --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,9 @@ +{ + "extends": [ + "eslint:recommended" + ], + "parserOptions": { + "ecmaVersion": 2018, + "sourceType": "module" + } +} \ No newline at end of file diff --git a/button-l5wa62wd/doc/button.mdx b/button-l5wa62wd/doc/button.mdx new file mode 100644 index 0000000..a41b262 --- /dev/null +++ b/button-l5wa62wd/doc/button.mdx @@ -0,0 +1,33 @@ +import { mdx } from '@mdx-js/react'; +import { Button } from '../index'; +import { Props, Description } from '@divriots/dockit-react/props'; +import { Playground } from '@divriots/dockit-react/playground'; +import { Layout } from '~/mdx-layout'; +export default Layout; + +# Button + + + +## Usage + +```tsx +import { Button } from '@divriots/starter-react-aria/button'; + +; +``` + +## Example + + alert('small button pressed!')}>Test + + + `} +/> + +## Props + + diff --git a/button-l5wa62wd/index.ts b/button-l5wa62wd/index.ts new file mode 100644 index 0000000..cced8ac --- /dev/null +++ b/button-l5wa62wd/index.ts @@ -0,0 +1 @@ +export * from './src/button'; diff --git a/button-l5wa62wd/src/button.module.scss b/button-l5wa62wd/src/button.module.scss new file mode 100644 index 0000000..dab6a54 --- /dev/null +++ b/button-l5wa62wd/src/button.module.scss @@ -0,0 +1,41 @@ +.button { + display: inline-flex; + appearance: none; + -webkit-box-align: center; + align-items: center; + -webkit-box-pack: center; + justify-content: center; + transition: all 250ms ease 0s; + user-select: none; + position: relative; + white-space: nowrap; + vertical-align: middle; + outline: transparent solid 2px; + outline-offset: 2px; + width: auto; + line-height: 1.2; + border-width: 0px; + border-radius: var(--aria-border-radius-medium); + font-weight: var(--aria-font-weight-semibold); + min-width: var(--aria-spacing-xx-large); + padding-inline-start: var(--aria-spacing-medium); + padding-inline-end: var(--aria-spacing-medium); + margin: 2px; + background: var(--aria-color-primary); + color: var(--aria-color-white); +} + +.small { + font-size: var(--aria-font-size-small); + height: var(--aria-spacing-x-large); +} + +.medium { + font-size: var(--aria-font-size-medium); + height: var(--aria-spacing-xx-large); +} + +.large { + font-size: var(--aria-font-size-large); + height: var(--aria-spacing-xxx-large); +} diff --git a/button-l5wa62wd/src/button.tsx b/button-l5wa62wd/src/button.tsx new file mode 100644 index 0000000..95fb60d --- /dev/null +++ b/button-l5wa62wd/src/button.tsx @@ -0,0 +1,36 @@ +import * as React from 'react'; +const { useRef } = React; +import type { ElementType, HTMLAttributes } from 'react'; +import type { AriaButtonProps } from '@react-types/button'; +import { useButton } from '@react-aria/button'; +import type { ButtonAria } from '@react-aria/button'; +import styles from './button.module.scss'; + +export type ButtonProps = AriaButtonProps & { + /** + Use the size prop to change the size of the button. You can set the value to 'small', 'medium' or 'large'. + */ + size: 'small' | 'medium' | 'large'; +}; + +/** + The Button component is used to trigger an action or event, such as submitting a form, opening a dialog, canceling an action, or performing a delete operation. +*/ +export const Button = ({ + size = 'medium', + ...rest +}: ButtonProps): ButtonAria> => { + const ref = useRef(); + const { buttonProps } = useButton(rest, ref); + const { children } = rest; + + return ( + + ); +}; diff --git a/button-l5wa62wd/stories/index.stories.tsx b/button-l5wa62wd/stories/index.stories.tsx new file mode 100644 index 0000000..a621241 --- /dev/null +++ b/button-l5wa62wd/stories/index.stories.tsx @@ -0,0 +1,27 @@ +import React from 'react'; +import { Button } from '../index'; +import '~/story-layout'; + +export default { + parameters: { + layout: 'centered', + }, +}; + +export const small_button = () => ( + +); + +export const medium_button = () => ( + +); + +export const large_button = () => ( + +); diff --git a/z-index/stories/zIndex.stories.tsx b/z-index/stories/zIndex.stories.tsx index c874c23..b284390 100644 --- a/z-index/stories/zIndex.stories.tsx +++ b/z-index/stories/zIndex.stories.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import '~/all/dist/all.css'; +import '~/all/src/all.scss'; import { StyleShowcases } from '@divriots/dockit-react/style-showcases'; -export const z_index = () => ; \ No newline at end of file +export const z_index = () => ;