Skip to content

Commit

Permalink
Merge pull request #532 from oasisprotocol/mz/tablet
Browse files Browse the repository at this point in the history
Tweak md breakpoint
  • Loading branch information
buberdds authored Jun 15, 2023
2 parents 19cb876 + 96669c4 commit 7d79541
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 10 deletions.
1 change: 1 addition & 0 deletions .changelog/532.bugfix.2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Adjust layout to new breakpoint
1 change: 1 addition & 0 deletions .changelog/532.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Set laptop breakpoint to handle more edge cases
8 changes: 6 additions & 2 deletions src/app/components/Blocks/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { paraTimesConfig } from '../../../config'
import { TablePaginationProps } from '../Table/TablePagination'
import { BlockHashLink, BlockLink } from './BlockLink'
import { formatDistanceStrict } from '../../utils/dateFormatter'
import { useScreenSize } from '../../hooks/useScreensize'

export type TableRuntimeBlock = RuntimeBlock & {
markAsNew?: boolean
Expand All @@ -28,12 +29,15 @@ type BlocksProps = {
export const Blocks = (props: BlocksProps) => {
const { isLoading, blocks, verbose, pagination, limit } = props
const { t } = useTranslation()

const { isLaptop } = useScreenSize()
const tableColumns: TableColProps[] = [
{ content: t('common.fill') },
{ content: t('common.height'), align: TableCellAlign.Right },
{ content: t('common.age'), align: TableCellAlign.Right },
{ content: t('common.transactions'), align: TableCellAlign.Right },
{
content: isLaptop ? t('common.transactionAbbreviation') : t('common.transactions'),
align: TableCellAlign.Right,
},
...(verbose ? [{ content: t('common.hash') }] : []),
{ content: t('common.size'), align: TableCellAlign.Right },
...(verbose ? [{ content: t('common.gasUsed'), align: TableCellAlign.Right }] : []),
Expand Down
4 changes: 2 additions & 2 deletions src/app/components/PageLayout/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ export const Header: FC = () => {
</Grid>
{scope && (
<>
<Grid md={6} xs={8}>
<Grid lg={6} xs={8}>
<NetworkSelector layer={scope.layer} network={scope.network} />
</Grid>
<Grid md={3} xs={0} />
<Grid lg={3} xs={0} />
</>
)}
</Grid>
Expand Down
6 changes: 3 additions & 3 deletions src/app/components/PageLayout/NetworkSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ type NetworkSelectorProps = {
export const NetworkSelector: FC<NetworkSelectorProps> = ({ layer, network }) => {
const { t } = useTranslation()
const navigate = useNavigate()
const { isDesktop, isMobile } = useScreenSize()
const { isMobile, isTablet } = useScreenSize()
const labels = getNetworkNames(t)
const [openDrawer, setOpenDrawer] = useState(false)
const handleDrawerClose = () => setOpenDrawer(false)
Expand All @@ -46,7 +46,7 @@ export const NetworkSelector: FC<NetworkSelectorProps> = ({ layer, network }) =>
sx={{
display: 'flex',
alignItems: 'center',
justifyContent: isDesktop ? 'center' : 'flex-end',
justifyContent: isTablet ? 'flex-end' : 'center',
}}
>
<ParaTimePicker
Expand All @@ -60,7 +60,7 @@ export const NetworkSelector: FC<NetworkSelectorProps> = ({ layer, network }) =>
{!isMobile && (
<NetworkButton isOutOfDate={outOfDate} layer={layer} network={network} onClick={handleDrawerOpen} />
)}
{isDesktop && network !== Network.mainnet && (
{!isTablet && network !== Network.mainnet && (
<StyledBox>
<Typography
component="span"
Expand Down
4 changes: 2 additions & 2 deletions src/app/components/PageLayout/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const StyledMain = styled('main')({

export const PageLayout: FC<PropsWithChildren<PageLayoutProps>> = ({ children, mobileFooterAction }) => {
const theme = useTheme()
const { isMobile, isDesktop } = useScreenSize()
const { isMobile, isTablet } = useScreenSize()
const scope = useScopeParam()
const isApiOffline = useIsApiOffline(scope?.network || Network.mainnet)

Expand Down Expand Up @@ -62,7 +62,7 @@ export const PageLayout: FC<PropsWithChildren<PageLayoutProps>> = ({ children, m
mb: 6,
}}
>
<Search scope={scope} variant={isDesktop ? 'button' : 'icon'} disabled={isApiOffline} />
<Search scope={scope} variant={isTablet ? 'icon' : 'button'} disabled={isApiOffline} />
</Box>
)}
<StyledMain>{children}</StyledMain>
Expand Down
3 changes: 2 additions & 1 deletion src/app/hooks/useScreensize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export const useScreenSize = () => {
return {
isMobile: useMediaQuery(theme.breakpoints.down('sm')),
isTablet: useMediaQuery(theme.breakpoints.down('md')),
isDesktop: useMediaQuery(theme.breakpoints.up('md')),
isLaptop: useMediaQuery(theme.breakpoints.down('lg')),
isDesktop: useMediaQuery(theme.breakpoints.up('lg')),
}
}
1 change: 1 addition & 0 deletions src/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
"to": "To",
"totalSent": "Total Sent",
"transactions": "Transactions",
"transactionAbbreviation": "Txs",
"txnFee": "Txn Fee",
"type": "Type",
"unknown": "Unknown",
Expand Down
6 changes: 6 additions & 0 deletions src/styles/theme/defaultTheme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,12 @@ declare module '@mui/material/styles' {
}

export const defaultTheme = createTheme({
breakpoints: {
values: {
...createTheme().breakpoints.values,
lg: 1024,
},
},
palette: {
background: {
default: COLORS.brandDark,
Expand Down

0 comments on commit 7d79541

Please sign in to comment.