Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ba40018
commit 864367d
Showing
25 changed files
with
835 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import './style.css' | ||
import './style.scss' | ||
import React from 'react' | ||
import { Button } from 'useful-components' | ||
|
||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
@import '../node_modules/useful-components/dist/variables'; | ||
|
||
#root { | ||
background-color: $analogous200; | ||
padding: 1rem; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
@import '../node_modules/useful-components/dist/variables'; | ||
|
||
#root { | ||
background-color: $analogous200; | ||
padding: 1rem; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
module.exports = { | ||
moduleNameMapper: { | ||
'\\.css$': '<rootDir>/mocks/styleMock.js', | ||
'\\.(css|scss)$': '<rootDir>/mocks/styleMock.js', | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,19 @@ | ||
import React, { FC } from 'react' | ||
import { number, color } from '@storybook/addon-knobs' | ||
import { boolean, select } from '@storybook/addon-knobs' | ||
import { Button } from './' | ||
|
||
const sizeOptions = { | ||
range: true, | ||
min: 0.125, | ||
max: 4, | ||
step: 0.005, | ||
} | ||
|
||
export default { | ||
component: Button, | ||
title: 'Button', | ||
} | ||
|
||
export const basic: FC = () => <Button>Basic</Button> | ||
|
||
export const custom: FC = () => ( | ||
export const Simple: FC = () => ( | ||
<Button | ||
fontSize={number('Size', 1, sizeOptions)} | ||
backgroundColor={color('Color', '#d36ac2')} | ||
disabled={boolean('Disabled', false)} | ||
kind={select('Kind', ['contained', 'outlined', 'text'], 'contained')} | ||
size={select('Size', ['small', 'medium', 'large'], 'medium')} | ||
tier={select('Tier', ['primary', 'secondary'], 'primary')} | ||
> | ||
Custom | ||
Simple | ||
</Button> | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,27 @@ | ||
import React, { FC, forwardRef } from 'react' | ||
import React, { forwardRef } from 'react' | ||
|
||
import { clsx } from '../utils' | ||
import { ButtonProps, ButtonRef, StyleProps } from './Button.types' | ||
import './button.css' | ||
|
||
const Button: FC<ButtonProps> = forwardRef<ButtonRef, ButtonProps>( | ||
({ children, backgroundColor, fontSize, style, ...props }, ref) => { | ||
const varStyle: StyleProps = { ...style } | ||
backgroundColor && (varStyle['--uc-background-color'] = backgroundColor) | ||
fontSize && (varStyle['--uc-font-size'] = `${fontSize}rem`) | ||
import { ButtonProps, ButtonRef, defaultProps } from './Button.types' | ||
import './button.scss' | ||
|
||
const Button = forwardRef<ButtonRef, ButtonProps>( | ||
({ children, kind, size, tier, ...props }, ref) => { | ||
return ( | ||
<button | ||
{...props} | ||
ref={ref} | ||
className={clsx('uc-button', props.className)} | ||
style={varStyle} | ||
className={clsx('artio-button', props.className)} | ||
data-kind={kind} | ||
data-size={size} | ||
data-tier={tier} | ||
> | ||
{children} | ||
</button> | ||
) | ||
} | ||
) | ||
|
||
Button.displayName = 'Button' | ||
Button.defaultProps = defaultProps | ||
|
||
export default Button |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,16 @@ | ||
import { ButtonHTMLAttributes, CSSProperties } from 'react' | ||
import { ButtonHTMLAttributes, ReactNode } from 'react' | ||
|
||
export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> { | ||
backgroundColor?: string | ||
fontSize?: number | ||
children?: ReactNode | ||
size?: 'small' | 'medium' | 'large' | ||
kind?: 'contained' | 'outlined' | 'text' | ||
tier?: 'primary' | 'secondary' | ||
} | ||
|
||
export type ButtonRef = HTMLButtonElement | ||
|
||
export interface StyleProps extends CSSProperties { | ||
'--uc-font-size'?: string | ||
'--uc-background-color'?: string | ||
export const defaultProps: ButtonProps = { | ||
kind: 'contained', | ||
size: 'medium', | ||
tier: 'primary', | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.