Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add core button variants #190

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/atoms/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { Spinner } from './Spinner';
interface OwnProps {
compact?: boolean;
loading?: boolean;
fullwidth?: boolean;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
fullwidth?: boolean;
fullWidth?: boolean;

}

export type ButtonProps = OwnProps & RebassButtonProps;
Expand All @@ -15,13 +16,15 @@ export const Button: FunctionComponent<ButtonProps> = ({
compact = false,
loading = false,
disabled = false,
fullwidth = false,
children,
...props
}) => (
<RebassButton
p={compact ? '0.625rem 2rem' : undefined}
pl={loading ? '1.5rem' : undefined}
fontSize={compact ? '0.9rem' : undefined}
width={fullwidth ? '100%' : undefined}
disabled={loading || disabled}
{...props}>
<Flex variant="horizontal-center">
Expand Down
2 changes: 1 addition & 1 deletion src/atoms/Icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export const Icon: FunctionComponent<IconProps & BoxProps> = ({
as={InlineSVG}
src={icons[type]}
width={width}
fill={get(theme.colors, (fill as keyof Theme['colors']) as string) || fill}
sx={{ fill: get(theme.colors, (fill as keyof Theme['colors']) as string) || fill }}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the reason for this?

{...props}
/>
);
Expand Down
4 changes: 2 additions & 2 deletions src/molecules/Banner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ export const Banner: FunctionComponent<BannerProps & Omit<BoxProps, 'label'>> =
variant="horizontal-start"
p={extendable ? '2' : '3'}
pb={'2'}
px={type === 'clear' && '0'}
px={type === 'clear' ? '0' : undefined}
justifyContent="space-between"
onClick={children && extendable ? handleToggle : undefined}
sx={{ cursor: children && extendable && 'pointer' }}
sx={{ cursor: children && extendable ? 'pointer' : undefined }}
{...omitMarginProps(props)}
data-testid="banner-toggle">
<Flex variant="horizontal-start">
Expand Down
44 changes: 43 additions & 1 deletion src/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ const COLORS = {
WHITE: '#ffffff',
GREY_LIGHT: '#d8d8d8',
GREY_ATHENS: '#e8eaed',
GREY_SECONDARY: '#b5bfc7'
GREY_SECONDARY: '#b5bfc7',
WARNING_ORANGE: '#fa873f'
};

const breakpoints: string[] & {
Expand Down Expand Up @@ -76,6 +77,8 @@ export const theme = {
spinner: '#a086f7',
loadingSpinner: '#7c9ec3',

warning: COLORS.WARNING_ORANGE,

background: {
muted: '#f6f8fa'
},
Expand All @@ -93,6 +96,9 @@ export const theme = {
},
inverted: {
hover: '#007896'
},
warning: {
hover: COLORS.WHITE
}
},

Expand Down Expand Up @@ -299,6 +305,36 @@ export const theme = {
}
}
},
warning: {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add this to Storybook?

cursor: 'pointer',
background: '',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

color: 'primary',
fontSize: 2,
fontFamily: 'body',
padding: '0.625rem 2.125rem',
borderRadius: 'small',
borderWidth: '0.125rem',
borderStyle: 'solid',
borderColor: 'primary',
transition: 'color 0.12s ease 0s, background 0.12s ease 0s, box-shadow 0.12s ease 0s',
'&:hover': {
backgroundColor: 'button.warning.hover',
color: 'text.inverted'
},
'&:focus': {
boxShadow: 'button',
outline: 'none'
},
'&:disabled': {
cursor: 'default',
borderColor: 'button.primary.disabled',
color: 'button.primary.disabled',
'&:hover': {
background: 'none',
color: 'button.primary.disabled'
}
}
},
clear: {
cursor: 'pointer',
background: 'none',
Expand All @@ -311,6 +347,12 @@ export const theme = {
'&:hover': {
transform: 'scale(1.05)'
}
},
basic: {
cursor: 'pointer',
background: 'none',
border: 'none',
p: 0
}
},
variants: {
Expand Down