-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(UI/Layout): use 'maxContentWidth' for the most of pages [YTFRONT…
…-4149] The following pages are ignores the option: - Accounts/Detailed Usage - CHYT - Components - Navigation/Document - Navigation/File - Navigation/ReplicatedTable - Navigation/Table - Navigation/Access log - QueryTracker - System - Bundles
- Loading branch information
1 parent
498c66c
commit 4764d6b
Showing
23 changed files
with
178 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
packages/ui/src/ui/containers/MaxContentWidth/MaxContentWidth.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
.yt-max-content-width { | ||
&_size_standard { | ||
max-width: 1400px; | ||
margin: 0 auto; | ||
|
||
.with-sticky-toolbar__toolbar_sticky .toolbar, | ||
.map-node__toolbar { | ||
max-width: 1360px; | ||
margin: 0 auto; | ||
} | ||
} | ||
|
||
&_size_wide { | ||
max-width: 1800px; | ||
margin: 0 auto; | ||
|
||
.with-sticky-toolbar__toolbar_sticky .toolbar, | ||
.map-node__toolbar { | ||
max-width: 1760px; | ||
margin: 0 auto; | ||
} | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
packages/ui/src/ui/containers/MaxContentWidth/MaxContentWidth.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import React from 'react'; | ||
import cn from 'bem-cn-lite'; | ||
import {useSelector} from 'react-redux'; | ||
|
||
import { | ||
getMaxContentWidth, | ||
isMaxContentWidthEnabled, | ||
} from '../../store/selectors/global/max-content-width'; | ||
|
||
import './MaxContentWidth.scss'; | ||
|
||
const block = cn('yt-max-content-width'); | ||
|
||
export type MaxContentWidthProps = { | ||
children: React.ReactNode; | ||
}; | ||
|
||
export function MaxContentWidth({children}: MaxContentWidthProps) { | ||
const enableMaxWidth = useSelector(isMaxContentWidthEnabled); | ||
const size = useSelector(getMaxContentWidth); | ||
|
||
return <div className={block({size: enableMaxWidth ? size : undefined})}>{children}</div>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import React from 'react'; | ||
import {useDispatch} from 'react-redux'; | ||
|
||
import {setMaxContentWidthEnabled} from '../../store/actions/global/max-content-width'; | ||
|
||
export function useDisableMaxContentWidth() { | ||
const dispatch = useDispatch(); | ||
|
||
React.useEffect(() => { | ||
dispatch(setMaxContentWidthEnabled(false)); | ||
|
||
return () => { | ||
dispatch(setMaxContentWidthEnabled(true)); | ||
}; | ||
}, [dispatch]); | ||
} | ||
|
||
export function UseDisableMaxContentWidth() { | ||
useDisableMaxContentWidth(); | ||
return null; | ||
} | ||
|
||
export function withDisableMaxContentWidth<Props extends object>( | ||
Component: React.ComponentType<Props>, | ||
) { | ||
return function WithDisableMaxContentWidth(props: Props) { | ||
useDisableMaxContentWidth(); | ||
return <Component {...props} />; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from './MaxContentWidth'; | ||
export * from './hooks'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,9 +12,6 @@ | |
} | ||
|
||
.elements-page { | ||
display: flex; | ||
flex-direction: column; | ||
|
||
min-width: 320px; | ||
min-height: 100vh; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.