Skip to content

Commit

Permalink
breakpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
kristiehuang committed Oct 10, 2023
1 parent 54a54da commit f11273b
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 26 deletions.
18 changes: 12 additions & 6 deletions src/components/Tokens/TokenTable/NetworkFilter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import { ApplicationModal } from 'state/application/reducer'
import styled, { css, useTheme } from 'styled-components'
import { EllipsisStyle } from 'theme/components'

import { LARGE_MEDIA_BREAKPOINT } from '../constants'
import FilterOption from './FilterOption'

const InternalMenuItem = styled.div`
Expand Down Expand Up @@ -50,7 +49,7 @@ const InternalLinkMenuItem = styled(InternalMenuItem)<{ disabled?: boolean }>`
`}
`
const MenuTimeFlyout = styled.span<{ isInfoExplorePageEnabled: boolean }>`
min-width: 150px;
min-width: ${({ isInfoExplorePageEnabled }) => (isInfoExplorePageEnabled ? '150px' : '240px')};
max-height: 350px;
overflow: auto;
background-color: ${({ theme }) => theme.surface1};
Expand All @@ -64,11 +63,18 @@ const MenuTimeFlyout = styled.span<{ isInfoExplorePageEnabled: boolean }>`
position: absolute;
top: 48px;
z-index: 100;
${({ isInfoExplorePageEnabled }) => (isInfoExplorePageEnabled ? 'right: 0px;' : 'left: 0px;')}
@media screen and (max-width: ${LARGE_MEDIA_BREAKPOINT}) {
left: 0px;
}
${({ isInfoExplorePageEnabled }) =>
isInfoExplorePageEnabled
? css`
right: 0px;
@media screen and (max-width: ${({ theme }) => `${theme.breakpoint.lg}px`}) {
left: 0px;
}
`
: css`
left: 0px;
`}
`
const StyledMenu = styled.div`
display: flex;
Expand Down
2 changes: 1 addition & 1 deletion src/components/Tokens/TokenTable/SearchBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const SearchInput = styled.input<{ isInfoExplorePageEnabled: boolean; isOpen?: b
padding-left: 40px;
color: ${({ theme }) => theme.neutral2};
transition-duration: ${({ theme }) => theme.transition.duration.fast};
${({ isInfoExplorePageEnabled }) => isInfoExplorePageEnabled && 'text-overflow: ellipsis;'}
${(isInfoExplorePageEnabled) => isInfoExplorePageEnabled && 'text-overflow: ellipsis;'}
:hover {
background-color: ${({ theme }) => theme.surface1};
Expand Down
30 changes: 18 additions & 12 deletions src/components/Tokens/TokenTable/TimeSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { useRef } from 'react'
import { Check, ChevronDown, ChevronUp } from 'react-feather'
import { useModalIsOpen, useToggleModal } from 'state/application/hooks'
import { ApplicationModal } from 'state/application/reducer'
import styled, { useTheme } from 'styled-components'
import styled, { css, useTheme } from 'styled-components'

import { MOBILE_MEDIA_BREAKPOINT, SMALL_MEDIA_BREAKPOINT } from '../constants'
import { filterTimeAtom } from '../state'
Expand Down Expand Up @@ -71,9 +71,14 @@ const MenuTimeFlyout = styled.span<{ isInfoExplorePageEnabled: boolean }>`
z-index: 100;
left: 0px;
@media only screen and (max-width: ${SMALL_MEDIA_BREAKPOINT}) {
${({ isInfoExplorePageEnabled }) => !isInfoExplorePageEnabled && 'left: unset; right: 0px;'}
}
${({ isInfoExplorePageEnabled }) =>
!isInfoExplorePageEnabled &&
css`
@media only screen and (max-width: ${SMALL_MEDIA_BREAKPOINT}) {
left: unset;
right: 0px;
}
`}
`
const StyledMenu = styled.div<{ isInfoExplorePageEnabled: boolean }>`
display: flex;
Expand All @@ -83,9 +88,13 @@ const StyledMenu = styled.div<{ isInfoExplorePageEnabled: boolean }>`
border: none;
text-align: left;
@media only screen and (max-width: ${MOBILE_MEDIA_BREAKPOINT}) {
${({ isInfoExplorePageEnabled }) => !isInfoExplorePageEnabled && 'width: 72px;'}
}
${({ isInfoExplorePageEnabled }) =>
!isInfoExplorePageEnabled &&
css`
@media only screen and (max-width: ${MOBILE_MEDIA_BREAKPOINT}) {
width: 72px;
}
`}
`
const StyledMenuContent = styled.div<{ isInfoExplorePageEnabled: boolean }>`
display: flex;
Expand Down Expand Up @@ -144,15 +153,12 @@ export default function TimeSelector() {
toggleMenu()
}}
>
{/* <div>
{DISPLAYS[time]} <Trans>volume</Trans>
</div> */}
{isInfoExplorePageEnabled ? (
<div>
{DISPLAYS[activeTime]} <Trans>volume</Trans>
{DISPLAYS[time]} <Trans>volume</Trans>
</div>
) : (
<div>{DISPLAYS[activeTime]}</div>
<div>{DISPLAYS[time]}</div>
)}
{time === activeTime && <Check color={theme.accent1} size={16} />}
</InternalLinkMenuItem>
Expand Down
9 changes: 2 additions & 7 deletions src/pages/Explore/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@ import { BrowserEvent, InterfaceElementName, InterfacePageName, SharedEventName
import { TraceEvent } from 'analytics'
import { Trace } from 'analytics'
import { AutoRow } from 'components/Row'
import {
LARGE_MEDIA_BREAKPOINT,
MAX_WIDTH_MEDIA_BREAKPOINT,
MEDIUM_MEDIA_BREAKPOINT,
} from 'components/Tokens/constants'
import { MAX_WIDTH_MEDIA_BREAKPOINT, MEDIUM_MEDIA_BREAKPOINT } from 'components/Tokens/constants'
import { filterStringAtom } from 'components/Tokens/state'
import NetworkFilter from 'components/Tokens/TokenTable/NetworkFilter'
import SearchBar from 'components/Tokens/TokenTable/SearchBar'
Expand Down Expand Up @@ -57,8 +53,7 @@ const NavWrapper = styled.div<{ isInfoExplorePageEnabled: boolean }>`
${({ isInfoExplorePageEnabled }) =>
isInfoExplorePageEnabled &&
css`
/* Use large media breakpoint so expanded search bar doesn't push tabs to next line */
@media screen and (max-width: ${LARGE_MEDIA_BREAKPOINT}) {
@media screen and (max-width: ${({ theme }) => `${theme.breakpoint.lg}px`}) {
flex-direction: column;
gap: 16px;
}
Expand Down

0 comments on commit f11273b

Please sign in to comment.