Commit 99446524 authored by tom goriunov's avatar tom goriunov Committed by GitHub

Merge pull request #2247 from blockscout/tom2drum/content-max-width

Change max width of page content
parents 3e24ed76 c07fb4e2
...@@ -109,6 +109,7 @@ const UI = Object.freeze({ ...@@ -109,6 +109,7 @@ const UI = Object.freeze({
heading: parseEnvJson<FontFamily>(getEnvValue('NEXT_PUBLIC_FONT_FAMILY_HEADING')), heading: parseEnvJson<FontFamily>(getEnvValue('NEXT_PUBLIC_FONT_FAMILY_HEADING')),
body: parseEnvJson<FontFamily>(getEnvValue('NEXT_PUBLIC_FONT_FAMILY_BODY')), body: parseEnvJson<FontFamily>(getEnvValue('NEXT_PUBLIC_FONT_FAMILY_BODY')),
}, },
maxContentWidth: getEnvValue('NEXT_PUBLIC_MAX_CONTENT_WIDTH_ENABLED') === 'false' ? false : true,
}); });
export default UI; export default UI;
...@@ -696,6 +696,7 @@ const schema = yup ...@@ -696,6 +696,7 @@ const schema = yup
const isUndefined = data === undefined; const isUndefined = data === undefined;
return isUndefined || fontFamilySchema.isValidSync(data); return isUndefined || fontFamilySchema.isValidSync(data);
}), }),
NEXT_PUBLIC_MAX_CONTENT_WIDTH_ENABLED: yup.boolean(),
// 5. Features configuration // 5. Features configuration
NEXT_PUBLIC_API_SPEC_URL: yup NEXT_PUBLIC_API_SPEC_URL: yup
......
...@@ -34,6 +34,7 @@ NEXT_PUBLIC_FOOTER_LINKS=https://example.com ...@@ -34,6 +34,7 @@ NEXT_PUBLIC_FOOTER_LINKS=https://example.com
NEXT_PUBLIC_GRAPHIQL_TRANSACTION=0xf7d4972356e6ae44ae948d0cf19ef2beaf0e574c180997e969a2837da15e349d NEXT_PUBLIC_GRAPHIQL_TRANSACTION=0xf7d4972356e6ae44ae948d0cf19ef2beaf0e574c180997e969a2837da15e349d
NEXT_PUBLIC_HIDE_INDEXING_ALERT_BLOCKS=false NEXT_PUBLIC_HIDE_INDEXING_ALERT_BLOCKS=false
NEXT_PUBLIC_HIDE_INDEXING_ALERT_INT_TXS=false NEXT_PUBLIC_HIDE_INDEXING_ALERT_INT_TXS=false
NEXT_PUBLIC_MAX_CONTENT_WIDTH_ENABLED=false
NEXT_PUBLIC_HOMEPAGE_CHARTS=['daily_txs'] NEXT_PUBLIC_HOMEPAGE_CHARTS=['daily_txs']
NEXT_PUBLIC_HOMEPAGE_STATS=['total_blocks','average_block_time','total_txs','wallet_addresses','gas_tracker','current_epoch'] NEXT_PUBLIC_HOMEPAGE_STATS=['total_blocks','average_block_time','total_txs','wallet_addresses','gas_tracker','current_epoch']
NEXT_PUBLIC_HOMEPAGE_PLATE_TEXT_COLOR='#fff' NEXT_PUBLIC_HOMEPAGE_PLATE_TEXT_COLOR='#fff'
......
...@@ -301,6 +301,7 @@ Settings for meta tags, OG tags and SEO ...@@ -301,6 +301,7 @@ Settings for meta tags, OG tags and SEO
| NEXT_PUBLIC_COLOR_THEME_DEFAULT | `'light' \| 'dim' \| 'midnight' \| 'dark'` | Preferred color theme of the app | - | - | `midnight` | v1.30.0+ | | NEXT_PUBLIC_COLOR_THEME_DEFAULT | `'light' \| 'dim' \| 'midnight' \| 'dark'` | Preferred color theme of the app | - | - | `midnight` | v1.30.0+ |
| NEXT_PUBLIC_FONT_FAMILY_HEADING | `FontFamily`, see full description [below](#font-family-configuration-properties) | Special typeface to use in page headings (`<h1>`, `<h2>`, etc.) | - | - | `{'name':'Montserrat','url':'https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700&display=swap'}` | v1.35.0+ | | NEXT_PUBLIC_FONT_FAMILY_HEADING | `FontFamily`, see full description [below](#font-family-configuration-properties) | Special typeface to use in page headings (`<h1>`, `<h2>`, etc.) | - | - | `{'name':'Montserrat','url':'https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700&display=swap'}` | v1.35.0+ |
| NEXT_PUBLIC_FONT_FAMILY_BODY | `FontFamily`, see full description [below](#font-family-configuration-properties) | Main typeface to use in page content elements. | - | - | `{'name':'Raleway','url':'https://fonts.googleapis.com/css2?family=Raleway:wght@400;500;600;700&display=swap'}` | v1.35.0+ | | NEXT_PUBLIC_FONT_FAMILY_BODY | `FontFamily`, see full description [below](#font-family-configuration-properties) | Main typeface to use in page content elements. | - | - | `{'name':'Raleway','url':'https://fonts.googleapis.com/css2?family=Raleway:wght@400;500;600;700&display=swap'}` | v1.35.0+ |
| NEXT_PUBLIC_MAX_CONTENT_WIDTH_ENABLED | `boolean` | Set to `true` to restrict the page content width on extra-large screens. | - | `true` | `false` | v1.34.1+ |
#### Network explorer configuration properties #### Network explorer configuration properties
......
import { Box, useColorModeValue } from '@chakra-ui/react';
import React from 'react';
interface Props {
children?: React.ReactNode;
}
const ContentWrapper = ({ children }: Props) => {
const bgColor = useColorModeValue('white', 'black');
return <Box bgColor={ bgColor }>{ children }</Box>;
};
export default React.memo(ContentWrapper);
...@@ -6,7 +6,6 @@ import React from 'react'; ...@@ -6,7 +6,6 @@ import React from 'react';
import type { JsonObject } from '@playwright/experimental-ct-core/types/component'; import type { JsonObject } from '@playwright/experimental-ct-core/types/component';
import ContentWrapper from 'playwright/ContentWrapper';
import type { Props as TestAppProps } from 'playwright/TestApp'; import type { Props as TestAppProps } from 'playwright/TestApp';
import TestApp from 'playwright/TestApp'; import TestApp from 'playwright/TestApp';
...@@ -28,7 +27,7 @@ export type RenderFixture = (component: JSX.Element, options?: Options, props?: ...@@ -28,7 +27,7 @@ export type RenderFixture = (component: JSX.Element, options?: Options, props?:
const fixture: TestFixture<RenderFixture, { mount: Mount }> = async({ mount }, use) => { const fixture: TestFixture<RenderFixture, { mount: Mount }> = async({ mount }, use) => {
await use((component, options, props) => { await use((component, options, props) => {
return mount( return mount(
<TestApp { ...props }><ContentWrapper>{ component }</ContentWrapper></TestApp>, <TestApp { ...props }>{ component }</TestApp>,
options, options,
); );
}); });
......
...@@ -4,6 +4,7 @@ export const viewport = { ...@@ -4,6 +4,7 @@ export const viewport = {
mobile: devices['iPhone 13 Pro'].viewport, mobile: devices['iPhone 13 Pro'].viewport,
md: { width: 1001, height: 800 }, md: { width: 1001, height: 800 },
xl: { width: 1600, height: 1000 }, xl: { width: 1600, height: 1000 },
xxl: { width: 1920, height: 1200 },
}; };
export const maskColor = '#4299E1'; // blue.400 export const maskColor = '#4299E1'; // blue.400
......
...@@ -4,8 +4,9 @@ const breakpoints = { ...@@ -4,8 +4,9 @@ const breakpoints = {
// md: '768px', // md: '768px',
lg: '1000px', lg: '1000px',
xl: '1440px', xl: '1440px',
'2xl': '1920px',
// these breakpoint are needed just to make others work // these breakpoint are needed just to make others work
'2xl': '3000px', '3xl': '3000px',
}; };
export default breakpoints; export default breakpoints;
...@@ -7,7 +7,7 @@ import getDefaultTransitionProps from './utils/getDefaultTransitionProps'; ...@@ -7,7 +7,7 @@ import getDefaultTransitionProps from './utils/getDefaultTransitionProps';
const global = (props: StyleFunctionProps) => ({ const global = (props: StyleFunctionProps) => ({
body: { body: {
bg: mode('gray.100', '#3A4957')(props), bg: mode('white', 'black')(props),
...getDefaultTransitionProps(), ...getDefaultTransitionProps(),
'-webkit-tap-highlight-color': 'transparent', '-webkit-tap-highlight-color': 'transparent',
'font-variant-ligatures': 'no-contextual', 'font-variant-ligatures': 'no-contextual',
......
...@@ -18,8 +18,8 @@ test('base view +@mobile', async({ render, mockEnvs, mockApiResponse }) => { ...@@ -18,8 +18,8 @@ test('base view +@mobile', async({ render, mockEnvs, mockApiResponse }) => {
await expect(component).toHaveScreenshot(); await expect(component).toHaveScreenshot();
}); });
test.describe('xl screen', () => { test.describe('xxl screen', () => {
test.use({ viewport: pwConfig.viewport.xl }); test.use({ viewport: pwConfig.viewport.xxl });
test('vertical navigation', async({ render }) => { test('vertical navigation', async({ render }) => {
const component = await render(<Layout>Page Content</Layout>); const component = await render(<Layout>Page Content</Layout>);
......
import { Box, chakra, useColorModeValue } from '@chakra-ui/react'; import { Box, chakra, useColorModeValue } from '@chakra-ui/react';
import React from 'react'; import React from 'react';
import config from 'configs/app';
import { CONTENT_MAX_WIDTH } from '../utils';
interface Props { interface Props {
children: React.ReactNode; children: React.ReactNode;
className?: string; className?: string;
...@@ -17,7 +13,6 @@ const Container = ({ children, className }: Props) => { ...@@ -17,7 +13,6 @@ const Container = ({ children, className }: Props) => {
<Box <Box
className={ className } className={ className }
minWidth={{ base: '100vw', lg: 'fit-content' }} minWidth={{ base: '100vw', lg: 'fit-content' }}
maxW={ config.UI.navigation.layout === 'horizontal' ? undefined : `${ CONTENT_MAX_WIDTH }px` }
m="0 auto" m="0 auto"
bgColor={ bgColor } bgColor={ bgColor }
> >
......
...@@ -16,6 +16,7 @@ const MainColumn = ({ children, className }: Props) => { ...@@ -16,6 +16,7 @@ const MainColumn = ({ children, className }: Props) => {
flexGrow={ 1 } flexGrow={ 1 }
w={{ base: '100%', lg: config.UI.navigation.layout === 'horizontal' ? '100%' : 'auto' }} w={{ base: '100%', lg: config.UI.navigation.layout === 'horizontal' ? '100%' : 'auto' }}
paddingX={{ base: 3, lg: config.UI.navigation.layout === 'horizontal' ? 6 : 12 }} paddingX={{ base: 3, lg: config.UI.navigation.layout === 'horizontal' ? 6 : 12 }}
paddingRight={{ '2xl': 6 }}
paddingTop={{ base: `${ 12 + 52 }px`, lg: 6 }} // 12px is top padding of content area, 52px is search bar height paddingTop={{ base: `${ 12 + 52 }px`, lg: 6 }} // 12px is top padding of content area, 52px is search bar height
paddingBottom={ 8 } paddingBottom={ 8 }
> >
......
import config from 'configs/app'; import config from 'configs/app';
export const CONTENT_MAX_WIDTH = config.UI.navigation.layout === 'horizontal' ? 1440 : 1512; const maxWidthVerticalNavigation = config.UI.maxContentWidth ? 1_920 : 10_000;
const maxWidthHorizontalNavigation = config.UI.maxContentWidth ? 1_440 : 10_000;
export const CONTENT_MAX_WIDTH = config.UI.navigation.layout === 'horizontal' ? maxWidthHorizontalNavigation : maxWidthVerticalNavigation;
...@@ -162,7 +162,7 @@ const Footer = () => { ...@@ -162,7 +162,7 @@ const Footer = () => {
}; };
const contentProps: GridProps = { const contentProps: GridProps = {
px: { base: 4, lg: config.UI.navigation.layout === 'horizontal' ? 6 : 12 }, px: { base: 4, lg: config.UI.navigation.layout === 'horizontal' ? 6 : 12, '2xl': 6 },
py: { base: 4, lg: 8 }, py: { base: 4, lg: 8 },
gridTemplateColumns: { base: '1fr', lg: 'minmax(auto, 470px) 1fr' }, gridTemplateColumns: { base: '1fr', lg: 'minmax(auto, 470px) 1fr' },
columnGap: { lg: '32px', xl: '100px' }, columnGap: { lg: '32px', xl: '100px' },
......
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