Commit ff6fd8a6 authored by cartcrom's avatar cartcrom Committed by GitHub

style: added transition ease to explore (#4616)

* initial commit
* updated transition css
* added opacity constants to theme, switched to using transition duration constants
parent 0a6906b2
...@@ -145,7 +145,7 @@ const CloseIcon = styled.div` ...@@ -145,7 +145,7 @@ const CloseIcon = styled.div`
top: 14px; top: 14px;
&:hover { &:hover {
cursor: pointer; cursor: pointer;
opacity: 0.6; opacity: ${({ theme }) => theme.opacity.hover};
} }
` `
......
...@@ -12,7 +12,7 @@ export const StyledChevronDown = styled(ChevronDown)<{ customColor?: string }>` ...@@ -12,7 +12,7 @@ export const StyledChevronDown = styled(ChevronDown)<{ customColor?: string }>`
theme: { theme: {
transition: { duration, timing }, transition: { duration, timing },
}, },
}) => `${duration.fast}ms color ${timing.in}`}; }) => `${duration.fast} color ${timing.in}`};
} }
` `
...@@ -27,6 +27,6 @@ export const StyledChevronUp = styled(ChevronUp)<{ customColor?: string }>` ...@@ -27,6 +27,6 @@ export const StyledChevronUp = styled(ChevronUp)<{ customColor?: string }>`
theme: { theme: {
transition: { duration, timing }, transition: { duration, timing },
}, },
}) => `${duration.fast}ms color ${timing.in}`}; }) => `${duration.fast} color ${timing.in}`};
} }
` `
...@@ -19,7 +19,7 @@ const HandleAccent = styled.path` ...@@ -19,7 +19,7 @@ const HandleAccent = styled.path`
stroke-width: 1.5; stroke-width: 1.5;
stroke: ${({ theme }) => theme.deprecated_white}; stroke: ${({ theme }) => theme.deprecated_white};
opacity: 0.6; opacity: ${({ theme }) => theme.opacity.hover};
` `
const LabelGroup = styled.g<{ visible: boolean }>` const LabelGroup = styled.g<{ visible: boolean }>`
......
...@@ -50,7 +50,7 @@ const ToggleWrap = styled.div` ...@@ -50,7 +50,7 @@ const ToggleWrap = styled.div`
` `
const ToggleLabel = styled.div` const ToggleLabel = styled.div`
opacity: 0.6; opacity: ${({ theme }) => theme.opacity.hover};
margin-right: 10px; margin-right: 10px;
` `
......
...@@ -8,7 +8,7 @@ import { navigatorLocale, useActiveLocale } from '../../hooks/useActiveLocale' ...@@ -8,7 +8,7 @@ import { navigatorLocale, useActiveLocale } from '../../hooks/useActiveLocale'
import { StyledInternalLink, ThemedText } from '../../theme' import { StyledInternalLink, ThemedText } from '../../theme'
const Container = styled(ThemedText.DeprecatedSmall)` const Container = styled(ThemedText.DeprecatedSmall)`
opacity: 0.6; opacity: ${({ theme }) => theme.opacity.hover};
:hover { :hover {
opacity: 1; opacity: 1;
} }
......
...@@ -64,7 +64,7 @@ const StyledCloseButton = styled(StyledButton)` ...@@ -64,7 +64,7 @@ const StyledCloseButton = styled(StyledButton)`
&:hover { &:hover {
background-color: ${({ theme }) => theme.backgroundInteractive}; background-color: ${({ theme }) => theme.backgroundInteractive};
opacity: 0.6; opacity: ${({ theme }) => theme.opacity.hover};
transition: opacity 250ms ease; transition: opacity 250ms ease;
} }
` `
...@@ -132,10 +132,10 @@ const ExplorerLinkWrapper = styled.div` ...@@ -132,10 +132,10 @@ const ExplorerLinkWrapper = styled.div`
cursor: pointer; cursor: pointer;
:hover { :hover {
opacity: 0.6; opacity: ${({ theme }) => theme.opacity.hover};
} }
:active { :active {
opacity: 0.4; opacity: ${({ theme }) => theme.opacity.click};
} }
` `
......
...@@ -10,6 +10,7 @@ export const BreadcrumbNavLink = styled(Link)` ...@@ -10,6 +10,7 @@ export const BreadcrumbNavLink = styled(Link)`
gap: 4px; gap: 4px;
text-decoration: none; text-decoration: none;
margin-bottom: 16px; margin-bottom: 16px;
transition-duration: ${({ theme }) => theme.transition.duration.fast};
&:hover { &:hover {
color: ${({ theme }) => theme.textTertiary}; color: ${({ theme }) => theme.textTertiary};
......
...@@ -13,7 +13,6 @@ import { useAtom } from 'jotai' ...@@ -13,7 +13,6 @@ import { useAtom } from 'jotai'
import { useCallback, useMemo, useState } from 'react' import { useCallback, useMemo, useState } from 'react'
import { ArrowDownRight, ArrowUpRight } from 'react-feather' import { ArrowDownRight, ArrowUpRight } from 'react-feather'
import styled, { useTheme } from 'styled-components/macro' import styled, { useTheme } from 'styled-components/macro'
import { OPACITY_HOVER } from 'theme'
import { import {
dayHourFormatter, dayHourFormatter,
hourFormatter, hourFormatter,
...@@ -109,8 +108,9 @@ const TimeButton = styled.button<{ active: boolean }>` ...@@ -109,8 +108,9 @@ const TimeButton = styled.button<{ active: boolean }>`
border: none; border: none;
cursor: pointer; cursor: pointer;
color: ${({ theme, active }) => (active ? theme.textPrimary : theme.textSecondary)}; color: ${({ theme, active }) => (active ? theme.textPrimary : theme.textSecondary)};
transition-duration: ${({ theme }) => theme.transition.duration.fast};
:hover { :hover {
${({ active }) => !active && `opacity: ${OPACITY_HOVER};`} ${({ active, theme }) => !active && `opacity: ${theme.opacity.hover};`}
} }
` `
......
...@@ -5,7 +5,7 @@ import { Twitter } from 'react-feather' ...@@ -5,7 +5,7 @@ import { Twitter } from 'react-feather'
import { useModalIsOpen, useToggleModal } from 'state/application/hooks' import { useModalIsOpen, useToggleModal } from 'state/application/hooks'
import { ApplicationModal } from 'state/application/reducer' import { ApplicationModal } from 'state/application/reducer'
import styled, { useTheme } from 'styled-components/macro' import styled, { useTheme } from 'styled-components/macro'
import { ClickableStyle, CopyHelperRefType, OPACITY_CLICK, Z_INDEX } from 'theme' import { ClickableStyle, CopyHelperRefType, Z_INDEX } from 'theme'
import { colors } from 'theme/colors' import { colors } from 'theme/colors'
import { opacify } from 'theme/utils' import { opacify } from 'theme/utils'
...@@ -25,7 +25,7 @@ const Share = styled(ShareIcon)<{ open: boolean }>` ...@@ -25,7 +25,7 @@ const Share = styled(ShareIcon)<{ open: boolean }>`
height: 24px; height: 24px;
width: 24px; width: 24px;
${ClickableStyle} ${ClickableStyle}
${({ open }) => open && `opacity: ${OPACITY_CLICK} !important`}; ${({ open, theme }) => open && `opacity: ${theme.opacity.click} !important`};
` `
const ShareActions = styled.div` const ShareActions = styled.div`
......
...@@ -5,6 +5,7 @@ import styled, { useTheme } from 'styled-components/macro' ...@@ -5,6 +5,7 @@ import styled, { useTheme } from 'styled-components/macro'
import { SMALLEST_MOBILE_MEDIA_BREAKPOINT } from '../constants' import { SMALLEST_MOBILE_MEDIA_BREAKPOINT } from '../constants'
import { showFavoritesAtom } from '../state' import { showFavoritesAtom } from '../state'
import FilterOption from './FilterOption'
const FavoriteButtonContent = styled.div` const FavoriteButtonContent = styled.div`
display: flex; display: flex;
...@@ -12,21 +13,6 @@ const FavoriteButtonContent = styled.div` ...@@ -12,21 +13,6 @@ const FavoriteButtonContent = styled.div`
align-items: center; align-items: center;
gap: 8px; gap: 8px;
` `
const StyledFavoriteButton = styled.button<{ active: boolean }>`
padding: 0px 16px;
border-radius: 12px;
background-color: ${({ theme, active }) => (active ? theme.accentActiveSoft : theme.backgroundInteractive)};
border: ${({ active, theme }) => (active ? `1px solid ${theme.accentActive}` : 'none')};
color: ${({ theme, active }) => (active ? theme.accentActive : theme.textPrimary)};
font-size: 16px;
font-weight: 600;
cursor: pointer;
:hover {
background-color: ${({ theme, active }) => !active && theme.backgroundModule};
opacity: ${({ active }) => (active ? '60%' : '100%')};
}
`
const FavoriteText = styled.span` const FavoriteText = styled.span`
@media only screen and (max-width: ${SMALLEST_MOBILE_MEDIA_BREAKPOINT}) { @media only screen and (max-width: ${SMALLEST_MOBILE_MEDIA_BREAKPOINT}) {
display: none; display: none;
...@@ -37,13 +23,13 @@ export default function FavoriteButton() { ...@@ -37,13 +23,13 @@ export default function FavoriteButton() {
const theme = useTheme() const theme = useTheme()
const [showFavorites, setShowFavorites] = useAtom(showFavoritesAtom) const [showFavorites, setShowFavorites] = useAtom(showFavoritesAtom)
return ( return (
<StyledFavoriteButton onClick={() => setShowFavorites(!showFavorites)} active={showFavorites}> <FilterOption onClick={() => setShowFavorites(!showFavorites)} active={showFavorites} highlight>
<FavoriteButtonContent> <FavoriteButtonContent>
<Heart size={17} color={showFavorites ? theme.accentActive : theme.textPrimary} /> <Heart size={20} color={showFavorites ? theme.accentActive : theme.textPrimary} />
<FavoriteText> <FavoriteText>
<Trans>Favorites</Trans> <Trans>Favorites</Trans>
</FavoriteText> </FavoriteText>
</FavoriteButtonContent> </FavoriteButtonContent>
</StyledFavoriteButton> </FilterOption>
) )
} }
//import { ReactNode } from 'react'
import styled from 'styled-components/macro'
const FilterOption = styled.button<{ active: boolean; highlight?: boolean }>`
height: 100%;
color: ${({ theme, active }) => (active ? theme.accentActive : theme.textPrimary)};
background-color: ${({ theme, active }) => (active ? theme.accentActiveSoft : theme.backgroundInteractive)};
margin: 0;
padding: 6px 12px 6px 14px;
border-radius: 12px;
font-size: 16px;
line-height: 24px;
font-weight: 600;
transition-duration: ${({ theme }) => theme.transition.duration.fast};
border: none;
outline: ${({ theme, active, highlight }) => (active && highlight ? `1px solid ${theme.accentAction}` : 'none')};
:hover {
cursor: pointer;
background-color: ${({ theme, active }) => (active ? theme.accentActiveSoft : theme.backgroundModule)};
opacity: ${({ theme, active }) => (active ? theme.opacity.hover : 1)};
}
:focus {
background-color: ${({ theme, active }) => (active ? theme.accentActiveSoft : theme.backgroundInteractive)};
}
`
export default FilterOption
...@@ -10,6 +10,7 @@ import styled, { useTheme } from 'styled-components/macro' ...@@ -10,6 +10,7 @@ import styled, { useTheme } from 'styled-components/macro'
import { MEDIUM_MEDIA_BREAKPOINT } from '../constants' import { MEDIUM_MEDIA_BREAKPOINT } from '../constants'
import { filterNetworkAtom } from '../state' import { filterNetworkAtom } from '../state'
import FilterOption from './FilterOption'
const NETWORKS = [ const NETWORKS = [
SupportedChainId.MAINNET, SupportedChainId.MAINNET,
...@@ -28,7 +29,6 @@ const InternalMenuItem = styled.div` ...@@ -28,7 +29,6 @@ const InternalMenuItem = styled.div`
text-decoration: none; text-decoration: none;
} }
` `
const InternalLinkMenuItem = styled(InternalMenuItem)` const InternalLinkMenuItem = styled(InternalMenuItem)`
display: flex; display: flex;
align-items: center; align-items: center;
...@@ -59,36 +59,6 @@ const MenuTimeFlyout = styled.span` ...@@ -59,36 +59,6 @@ const MenuTimeFlyout = styled.span`
z-index: 100; z-index: 100;
left: 0px; left: 0px;
` `
const StyledMenuButton = styled.button<{ open: boolean }>`
width: 100%;
height: 100%;
color: ${({ theme, open }) => (open ? theme.accentActive : theme.textPrimary)};
border: none;
background-color: ${({ theme, open }) => (open ? theme.accentActiveSoft : theme.backgroundInteractive)};
margin: 0;
padding: 6px 12px 6px 12px;
border-radius: 12px;
font-size: 16px;
line-height: 24px;
font-weight: 400;
:hover {
cursor: pointer;
outline: none;
border: none;
background-color: ${({ theme, open }) => (open ? theme.accentActiveSoft : theme.backgroundModule)};
}
:focus {
background-color: ${({ theme, open }) => (open ? theme.accentActiveSoft : theme.backgroundInteractive)};
border: none;
outline: none;
}
svg {
margin-top: 2px;
}
`
const StyledMenu = styled.div` const StyledMenu = styled.div`
display: flex; display: flex;
justify-content: center; justify-content: center;
...@@ -96,23 +66,21 @@ const StyledMenu = styled.div` ...@@ -96,23 +66,21 @@ const StyledMenu = styled.div`
position: relative; position: relative;
border: none; border: none;
text-align: left; text-align: left;
width: 160px;
@media only screen and (max-width: ${MEDIUM_MEDIA_BREAKPOINT}) { @media only screen and (max-width: ${MEDIUM_MEDIA_BREAKPOINT}) {
flex: 1; flex: 1;
} }
` `
const StyledMenuContent = styled.div` const StyledMenuContent = styled.div`
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
gap: 8px;
align-items: center; align-items: center;
border: none; border: none;
width: 100%; width: 100%;
font-weight: 600; font-weight: 600;
vertical-align: middle; vertical-align: middle;
` `
const Chevron = styled.span<{ open: boolean }>` const Chevron = styled.span<{ open: boolean }>`
padding-top: 1px; padding-top: 1px;
color: ${({ open, theme }) => (open ? theme.accentActive : theme.textSecondary)}; color: ${({ open, theme }) => (open ? theme.accentActive : theme.textSecondary)};
...@@ -143,16 +111,20 @@ export default function NetworkFilter() { ...@@ -143,16 +111,20 @@ export default function NetworkFilter() {
return ( return (
<StyledMenu ref={node}> <StyledMenu ref={node}>
<StyledMenuButton onClick={toggleMenu} aria-label={`networkFilter`} open={open}> <FilterOption onClick={toggleMenu} aria-label={`networkFilter`} active={open}>
<StyledMenuContent> <StyledMenuContent>
<NetworkLabel> <NetworkLabel>
<Logo src={circleLogoUrl ?? logoUrl} /> {label} <Logo src={circleLogoUrl ?? logoUrl} /> {label}
</NetworkLabel> </NetworkLabel>
<Chevron open={open}> <Chevron open={open}>
{open ? <ChevronUp size={15} viewBox="0 0 24 20" /> : <ChevronDown size={15} viewBox="0 0 24 20" />} {open ? (
<ChevronUp width={20} height={15} viewBox="0 0 24 20" />
) : (
<ChevronDown width={20} height={15} viewBox="0 0 24 20" />
)}
</Chevron> </Chevron>
</StyledMenuContent> </StyledMenuContent>
</StyledMenuButton> </FilterOption>
{open && ( {open && (
<MenuTimeFlyout> <MenuTimeFlyout>
{NETWORKS.map((network) => ( {NETWORKS.map((network) => (
......
...@@ -27,6 +27,7 @@ const SearchInput = styled.input` ...@@ -27,6 +27,7 @@ const SearchInput = styled.input`
font-size: 16px; font-size: 16px;
padding-left: 40px; padding-left: 40px;
color: ${({ theme }) => theme.textSecondary}; color: ${({ theme }) => theme.textSecondary};
transition-duration: ${({ theme }) => theme.transition.duration.fast};
:hover { :hover {
background-color: ${({ theme }) => theme.backgroundSurface}; background-color: ${({ theme }) => theme.backgroundSurface};
......
...@@ -9,6 +9,7 @@ import styled, { useTheme } from 'styled-components/macro' ...@@ -9,6 +9,7 @@ import styled, { useTheme } from 'styled-components/macro'
import { MOBILE_MEDIA_BREAKPOINT, SMALL_MEDIA_BREAKPOINT } from '../constants' import { MOBILE_MEDIA_BREAKPOINT, SMALL_MEDIA_BREAKPOINT } from '../constants'
import { filterTimeAtom } from '../state' import { filterTimeAtom } from '../state'
import FilterOption from './FilterOption'
export const DISPLAYS: Record<TimePeriod, string> = { export const DISPLAYS: Record<TimePeriod, string> = {
[TimePeriod.HOUR]: '1H', [TimePeriod.HOUR]: '1H',
...@@ -39,7 +40,6 @@ const InternalMenuItem = styled.div` ...@@ -39,7 +40,6 @@ const InternalMenuItem = styled.div`
text-decoration: none; text-decoration: none;
} }
` `
const InternalLinkMenuItem = styled(InternalMenuItem)` const InternalLinkMenuItem = styled(InternalMenuItem)`
display: flex; display: flex;
flex-direction: row; flex-direction: row;
...@@ -76,36 +76,6 @@ const MenuTimeFlyout = styled.span` ...@@ -76,36 +76,6 @@ const MenuTimeFlyout = styled.span`
left: unset; left: unset;
} }
` `
const StyledMenuButton = styled.button<{ open: boolean }>`
width: 100%;
height: 100%;
border: none;
color: ${({ theme, open }) => (open ? theme.accentActive : theme.textPrimary)};
margin: 0;
background-color: ${({ theme, open }) => (open ? theme.accentActiveSoft : theme.backgroundInteractive)};
padding: 6px 12px 6px 12px;
border-radius: 12px;
font-size: 16px;
line-height: 24px;
font-weight: 600;
:hover {
cursor: pointer;
border: none;
outline: none;
background-color: ${({ theme, open }) => (open ? theme.accentActiveSoft : theme.backgroundModule)};
}
:focus {
background-color: ${({ theme, open }) => (open ? theme.accentActiveSoft : theme.backgroundInteractive)};
border: none;
outline: none;
}
svg {
margin-top: 2px;
}
`
const StyledMenu = styled.div` const StyledMenu = styled.div`
display: flex; display: flex;
justify-content: center; justify-content: center;
...@@ -113,22 +83,20 @@ const StyledMenu = styled.div` ...@@ -113,22 +83,20 @@ const StyledMenu = styled.div`
position: relative; position: relative;
border: none; border: none;
text-align: left; text-align: left;
width: 80px;
@media only screen and (max-width: ${MOBILE_MEDIA_BREAKPOINT}) { @media only screen and (max-width: ${MOBILE_MEDIA_BREAKPOINT}) {
width: 72px; width: 72px;
} }
` `
const StyledMenuContent = styled.div` const StyledMenuContent = styled.div`
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
gap: 8px;
align-items: center; align-items: center;
border: none; border: none;
width: 100%; width: 100%;
vertical-align: middle; vertical-align: middle;
` `
const Chevron = styled.span<{ open: boolean }>` const Chevron = styled.span<{ open: boolean }>`
padding-top: 1px; padding-top: 1px;
color: ${({ open, theme }) => (open ? theme.accentActive : theme.textSecondary)}; color: ${({ open, theme }) => (open ? theme.accentActive : theme.textSecondary)};
...@@ -145,14 +113,18 @@ export default function TimeSelector() { ...@@ -145,14 +113,18 @@ export default function TimeSelector() {
return ( return (
<StyledMenu ref={node}> <StyledMenu ref={node}>
<StyledMenuButton onClick={toggleMenu} aria-label={`timeSelector`} open={open}> <FilterOption onClick={toggleMenu} aria-label={`timeSelector`} active={open}>
<StyledMenuContent> <StyledMenuContent>
{DISPLAYS[activeTime]} {DISPLAYS[activeTime]}
<Chevron open={open}> <Chevron open={open}>
{open ? <ChevronUp size={15} viewBox="0 0 24 20" /> : <ChevronDown size={15} viewBox="0 0 24 20" />} {open ? (
<ChevronUp width={20} height={15} viewBox="0 0 24 20" />
) : (
<ChevronDown width={20} height={15} viewBox="0 0 24 20" />
)}
</Chevron> </Chevron>
</StyledMenuContent> </StyledMenuContent>
</StyledMenuButton> </FilterOption>
{open && ( {open && (
<MenuTimeFlyout> <MenuTimeFlyout>
{ORDERED_TIMES.map((time) => ( {ORDERED_TIMES.map((time) => (
......
...@@ -61,6 +61,7 @@ const StyledTokenRow = styled.div<{ first?: boolean; last?: boolean; loading?: b ...@@ -61,6 +61,7 @@ const StyledTokenRow = styled.div<{ first?: boolean; last?: boolean; loading?: b
}, },
}) => css`background-color ${duration.medium} ${timing.ease}`}; }) => css`background-color ${duration.medium} ${timing.ease}`};
width: 100%; width: 100%;
transition-duration: ${({ theme }) => theme.transition.duration.fast};
&:hover { &:hover {
${({ loading, theme }) => ${({ loading, theme }) =>
...@@ -225,15 +226,12 @@ const SortArrowCell = styled(Cell)` ...@@ -225,15 +226,12 @@ const SortArrowCell = styled(Cell)`
` `
const HeaderCellWrapper = styled.span<{ onClick?: () => void }>` const HeaderCellWrapper = styled.span<{ onClick?: () => void }>`
align-items: center; align-items: center;
${ClickableStyle}
cursor: ${({ onClick }) => (onClick ? 'pointer' : 'unset')}; cursor: ${({ onClick }) => (onClick ? 'pointer' : 'unset')};
display: flex; display: flex;
height: 100%; height: 100%;
justify-content: flex-end; justify-content: flex-end;
width: 100%; width: 100%;
&:hover {
opacity: 60%;
}
` `
const SparkLineCell = styled(Cell)` const SparkLineCell = styled(Cell)`
padding: 0px 24px; padding: 0px 24px;
......
...@@ -32,7 +32,7 @@ const PopupContainer = styled.div<{ show: boolean }>` ...@@ -32,7 +32,7 @@ const PopupContainer = styled.div<{ show: boolean }>`
theme: { theme: {
transition: { duration, timing }, transition: { duration, timing },
}, },
}) => `${duration.slow}ms opacity ${timing.in}`}; }) => `${duration.slow} opacity ${timing.in}`};
` `
const Header = styled.div` const Header = styled.div`
display: flex; display: flex;
......
...@@ -55,7 +55,7 @@ const ToggleMenuItem = styled.button` ...@@ -55,7 +55,7 @@ const ToggleMenuItem = styled.button`
theme: { theme: {
transition: { duration, timing }, transition: { duration, timing },
}, },
}) => `${duration.fast}ms all ${timing.in}`}; }) => `${duration.fast} all ${timing.in}`};
} }
` `
......
...@@ -28,7 +28,7 @@ const IconStyles = css` ...@@ -28,7 +28,7 @@ const IconStyles = css`
theme: { theme: {
transition: { duration, timing }, transition: { duration, timing },
}, },
}) => `${duration.fast}ms background-color ${timing.in}`}; }) => `${duration.fast} background-color ${timing.in}`};
${IconHoverText} { ${IconHoverText} {
opacity: 1; opacity: 1;
......
...@@ -33,7 +33,7 @@ const InternalLinkMenuItem = styled(InternalMenuItem)` ...@@ -33,7 +33,7 @@ const InternalLinkMenuItem = styled(InternalMenuItem)`
theme: { theme: {
transition: { duration, timing }, transition: { duration, timing },
}, },
}) => `${duration.fast}ms background-color ${timing.in}`}; }) => `${duration.fast} background-color ${timing.in}`};
} }
` `
......
...@@ -42,12 +42,12 @@ const ClearAll = styled.div` ...@@ -42,12 +42,12 @@ const ClearAll = styled.div`
margin-bottom: auto; margin-bottom: auto;
:hover { :hover {
opacity: 0.6; opacity: ${({ theme }) => theme.opacity.hover};
transition: ${({ transition: ${({
theme: { theme: {
transition: { duration, timing }, transition: { duration, timing },
}, },
}) => `${duration.fast}ms opacity ${timing.in}`}; }) => `${duration.fast} opacity ${timing.in}`};
} }
` `
...@@ -60,7 +60,7 @@ const StyledChevron = styled(ChevronLeft)` ...@@ -60,7 +60,7 @@ const StyledChevron = styled(ChevronLeft)`
theme: { theme: {
transition: { duration, timing }, transition: { duration, timing },
}, },
}) => `${duration.fast}ms color ${timing.in}`}; }) => `${duration.fast} color ${timing.in}`};
} }
` `
......
...@@ -35,7 +35,7 @@ const CloseIcon = styled.div` ...@@ -35,7 +35,7 @@ const CloseIcon = styled.div`
top: 14px; top: 14px;
&:hover { &:hover {
cursor: pointer; cursor: pointer;
opacity: 0.6; opacity: ${({ theme }) => theme.opacity.hover};
} }
` `
......
...@@ -171,7 +171,7 @@ const StyledConnect = styled.div` ...@@ -171,7 +171,7 @@ const StyledConnect = styled.div`
theme: { theme: {
transition: { duration, timing }, transition: { duration, timing },
}, },
}) => `${duration.fast}ms color ${timing.in}`}; }) => `${duration.fast} color ${timing.in}`};
} }
` `
......
...@@ -73,7 +73,7 @@ const Proposal = styled(Button)` ...@@ -73,7 +73,7 @@ const Proposal = styled(Button)`
` `
const ProposalNumber = styled.span` const ProposalNumber = styled.span`
opacity: 0.6; opacity: ${({ theme }) => theme.opacity.hover};
flex: 0 0 40px; flex: 0 0 40px;
` `
......
...@@ -64,9 +64,6 @@ export const LinkStyledButton = styled.button<{ disabled?: boolean }>` ...@@ -64,9 +64,6 @@ export const LinkStyledButton = styled.button<{ disabled?: boolean }>`
} }
` `
export const OPACITY_HOVER = 0.6
export const OPACITY_CLICK = 0.4
export const ButtonText = styled.button` export const ButtonText = styled.button`
outline: none; outline: none;
border: none; border: none;
...@@ -75,9 +72,10 @@ export const ButtonText = styled.button` ...@@ -75,9 +72,10 @@ export const ButtonText = styled.button`
margin: 0; margin: 0;
background: none; background: none;
cursor: pointer; cursor: pointer;
transition-duration: ${({ theme }) => theme.transition.duration.fast};
:hover { :hover {
opacity: ${OPACITY_HOVER}; opacity: ${({ theme }) => theme.opacity.hover};
} }
:focus { :focus {
...@@ -88,12 +86,13 @@ export const ButtonText = styled.button` ...@@ -88,12 +86,13 @@ export const ButtonText = styled.button`
export const ClickableStyle = css` export const ClickableStyle = css`
text-decoration: none; text-decoration: none;
cursor: pointer; cursor: pointer;
transition-duration: ${({ theme }) => theme.transition.duration.fast};
:hover { :hover {
opacity: ${OPACITY_HOVER}; opacity: ${({ theme }) => theme.opacity.hover};
} }
:active { :active {
opacity: ${OPACITY_CLICK}; opacity: ${({ theme }) => theme.opacity.click};
} }
` `
...@@ -135,6 +134,7 @@ const CopyIcon = styled(Copy)` ...@@ -135,6 +134,7 @@ const CopyIcon = styled(Copy)`
` `
export const TrashIcon = styled(Trash)` export const TrashIcon = styled(Trash)`
${ClickableStyle}
${IconStyle} ${IconStyle}
stroke: ${({ theme }) => theme.deprecated_text3}; stroke: ${({ theme }) => theme.deprecated_text3};
...@@ -142,10 +142,6 @@ export const TrashIcon = styled(Trash)` ...@@ -142,10 +142,6 @@ export const TrashIcon = styled(Trash)`
align-items: center; align-items: center;
justify-content: center; justify-content: center;
display: flex; display: flex;
:hover {
opacity: ${OPACITY_HOVER};
}
` `
const rotateImg = keyframes` const rotateImg = keyframes`
...@@ -296,7 +292,7 @@ const CopyAddressRow = styled.div<{ isClicked: boolean }>` ...@@ -296,7 +292,7 @@ const CopyAddressRow = styled.div<{ isClicked: boolean }>`
justify-content: center; justify-content: center;
display: flex; display: flex;
gap: 6px; gap: 6px;
${({ isClicked }) => isClicked && `opacity: ` + OPACITY_CLICK + ` !important`} ${({ theme, isClicked }) => isClicked && `opacity: ${theme.opacity.click} !important`}
` `
const CopyContractAddressWrapper = styled.div` const CopyContractAddressWrapper = styled.div`
......
...@@ -39,9 +39,9 @@ const BREAKPOINTS = { ...@@ -39,9 +39,9 @@ const BREAKPOINTS = {
const transitions = { const transitions = {
duration: { duration: {
slow: 500, slow: '500ms',
medium: 250, medium: '250ms',
fast: 125, fast: '125ms',
}, },
timing: { timing: {
ease: 'ease', ease: 'ease',
...@@ -51,6 +51,11 @@ const transitions = { ...@@ -51,6 +51,11 @@ const transitions = {
}, },
} }
const opacities = {
hover: 0.6,
click: 0.4,
}
// Migrating to a standard z-index system https://getbootstrap.com/docs/5.0/layout/z-index/ // Migrating to a standard z-index system https://getbootstrap.com/docs/5.0/layout/z-index/
// Please avoid using deprecated numbers // Please avoid using deprecated numbers
export enum Z_INDEX { export enum Z_INDEX {
...@@ -288,6 +293,8 @@ function getTheme(darkMode: boolean, isNewColorsEnabled: boolean): DefaultTheme ...@@ -288,6 +293,8 @@ function getTheme(darkMode: boolean, isNewColorsEnabled: boolean): DefaultTheme
transition: transitions, transition: transitions,
opacity: opacities,
// css snippets // css snippets
flexColumnNoWrap: css` flexColumnNoWrap: css`
display: flex; display: flex;
......
...@@ -144,9 +144,9 @@ declare module 'styled-components/macro' { ...@@ -144,9 +144,9 @@ declare module 'styled-components/macro' {
} }
transition: { transition: {
duration: { duration: {
slow: number slow: string
medium: number medium: string
fast: number fast: string
} }
timing: { timing: {
ease: string ease: string
...@@ -155,6 +155,10 @@ declare module 'styled-components/macro' { ...@@ -155,6 +155,10 @@ declare module 'styled-components/macro' {
inOut: string inOut: string
} }
} }
opacity: {
hover: number
click: number
}
// css snippets // css snippets
flexColumnNoWrap: FlattenSimpleInterpolation flexColumnNoWrap: FlattenSimpleInterpolation
flexRowNoWrap: FlattenSimpleInterpolation flexRowNoWrap: FlattenSimpleInterpolation
......
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