Commit 1843f214 authored by lynn's avatar lynn Committed by GitHub

fix: hover button states (#5553)

* init but this looks wrong based on figma

* init

* fix props

* add back children
parent c098ad1f
......@@ -7,14 +7,26 @@ import { RowBetween } from '../Row'
type ButtonProps = Omit<ButtonPropsOriginal, 'css'>
export const BaseButton = styled(RebassButton)<
{
const ButtonOverlay = styled.div`
background-color: transparent;
bottom: 0;
border-radius: 16px;
height: 100%;
left: 0;
position: absolute;
right: 0;
top: 0;
transition: 150ms ease background-color;
width: 100%;
`
type BaseButtonProps = {
padding?: string
width?: string
$borderRadius?: string
altDisabledStyle?: boolean
} & ButtonProps
>`
} & ButtonProps
export const BaseButton = styled(RebassButton)<BaseButtonProps>`
padding: ${({ padding }) => padding ?? '16px'};
width: ${({ width }) => width ?? '100%'};
font-weight: 500;
......@@ -86,7 +98,7 @@ export const SmallButtonPrimary = styled(ButtonPrimary)`
border-radius: 12px;
`
export const ButtonLight = styled(BaseButton)`
const BaseButtonLight = styled(BaseButton)`
background-color: ${({ theme }) => theme.accentActionSoft};
color: ${({ theme }) => theme.accentAction};
font-size: 20px;
......@@ -103,6 +115,19 @@ export const ButtonLight = styled(BaseButton)`
box-shadow: 0 0 0 1pt ${({ theme, disabled }) => !disabled && theme.accentActionSoft};
background-color: ${({ theme, disabled }) => !disabled && theme.accentActionSoft};
}
:hover {
${ButtonOverlay} {
background-color: ${({ theme }) => theme.stateOverlayHover};
}
}
:active {
${ButtonOverlay} {
background-color: ${({ theme }) => theme.stateOverlayPressed};
}
}
:disabled {
opacity: 0.4;
:hover {
......@@ -369,18 +394,6 @@ export function ButtonRadioChecked({ active = false, children, ...rest }: { acti
}
}
const ButtonOverlay = styled.div`
background-color: transparent;
bottom: 0;
border-radius: 16px;
height: 100%;
left: 0;
position: absolute;
right: 0;
top: 0;
transition: 150ms ease background-color;
width: 100%;
`
export enum ButtonSize {
small,
medium,
......@@ -395,7 +408,7 @@ export enum ButtonEmphasis {
warning,
destructive,
}
interface BaseButtonProps {
interface BaseThemeButtonProps {
size: ButtonSize
emphasis: ButtonEmphasis
}
......@@ -474,7 +487,7 @@ function pickThemeButtonTextColor({ theme, emphasis }: { theme: DefaultTheme; em
}
}
const BaseThemeButton = styled.button<BaseButtonProps>`
const BaseThemeButton = styled.button<BaseThemeButtonProps>`
align-items: center;
background-color: ${pickThemeButtonBackgroundColor};
border-radius: 16px;
......@@ -513,7 +526,7 @@ const BaseThemeButton = styled.button<BaseButtonProps>`
}
`
interface ThemeButtonProps extends React.ComponentPropsWithoutRef<'button'>, BaseButtonProps {}
interface ThemeButtonProps extends React.ComponentPropsWithoutRef<'button'>, BaseThemeButtonProps {}
export const ThemeButton = ({ children, ...rest }: ThemeButtonProps) => {
return (
......@@ -523,3 +536,12 @@ export const ThemeButton = ({ children, ...rest }: ThemeButtonProps) => {
</BaseThemeButton>
)
}
export const ButtonLight = ({ children, ...rest }: BaseButtonProps) => {
return (
<BaseButtonLight {...rest}>
<ButtonOverlay />
{children}
</BaseButtonLight>
)
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment