Extract center column offset, reduce by 20px (#7974)
* extract offset, reduce by 20px * move constant to `Layout/const.ts`
This commit is contained in:
@@ -23,6 +23,7 @@ import {ArrowLeft_Stroke2_Corner0_Rounded as ArrowLeft} from '#/components/icons
|
|||||||
import {Menu_Stroke2_Corner0_Rounded as Menu} from '#/components/icons/Menu'
|
import {Menu_Stroke2_Corner0_Rounded as Menu} from '#/components/icons/Menu'
|
||||||
import {
|
import {
|
||||||
BUTTON_VISUAL_ALIGNMENT_OFFSET,
|
BUTTON_VISUAL_ALIGNMENT_OFFSET,
|
||||||
|
CENTER_COLUMN_OFFSET,
|
||||||
HEADER_SLOT_SIZE,
|
HEADER_SLOT_SIZE,
|
||||||
SCROLLBAR_OFFSET,
|
SCROLLBAR_OFFSET,
|
||||||
} from '#/components/Layout/const'
|
} from '#/components/Layout/const'
|
||||||
@@ -65,7 +66,7 @@ export function Outer({
|
|||||||
gtMobile && [a.mx_auto, {maxWidth: 600}],
|
gtMobile && [a.mx_auto, {maxWidth: 600}],
|
||||||
!isWithinOffsetView && {
|
!isWithinOffsetView && {
|
||||||
transform: [
|
transform: [
|
||||||
{translateX: centerColumnOffset ? -150 : 0},
|
{translateX: centerColumnOffset ? CENTER_COLUMN_OFFSET : 0},
|
||||||
{translateX: web(SCROLLBAR_OFFSET) ?? 0},
|
{translateX: web(SCROLLBAR_OFFSET) ?? 0},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -14,3 +14,8 @@ export const BUTTON_VISUAL_ALIGNMENT_OFFSET = 3
|
|||||||
* Corresponds to the width of a small square or round button
|
* Corresponds to the width of a small square or round button
|
||||||
*/
|
*/
|
||||||
export const HEADER_SLOT_SIZE = 34
|
export const HEADER_SLOT_SIZE = 34
|
||||||
|
|
||||||
|
/**
|
||||||
|
* How far to shift the center column when in the tablet breakpoint
|
||||||
|
*/
|
||||||
|
export const CENTER_COLUMN_OFFSET = -130
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import {
|
|||||||
web,
|
web,
|
||||||
} from '#/alf'
|
} from '#/alf'
|
||||||
import {useDialogContext} from '#/components/Dialog'
|
import {useDialogContext} from '#/components/Dialog'
|
||||||
import {SCROLLBAR_OFFSET} from '#/components/Layout/const'
|
import {CENTER_COLUMN_OFFSET, SCROLLBAR_OFFSET} from '#/components/Layout/const'
|
||||||
import {ScrollbarOffsetContext} from '#/components/Layout/context'
|
import {ScrollbarOffsetContext} from '#/components/Layout/context'
|
||||||
|
|
||||||
export * from '#/components/Layout/const'
|
export * from '#/components/Layout/const'
|
||||||
@@ -173,7 +173,7 @@ export const Center = React.memo(function LayoutContent({
|
|||||||
centerColumnOffset &&
|
centerColumnOffset &&
|
||||||
!ignoreTabletLayoutOffset &&
|
!ignoreTabletLayoutOffset &&
|
||||||
!isWithinDialog
|
!isWithinDialog
|
||||||
? -150
|
? CENTER_COLUMN_OFFSET
|
||||||
: 0,
|
: 0,
|
||||||
},
|
},
|
||||||
{translateX: web(SCROLLBAR_OFFSET) ?? 0},
|
{translateX: web(SCROLLBAR_OFFSET) ?? 0},
|
||||||
@@ -209,7 +209,7 @@ const WebCenterBorders = React.memo(function LayoutContent() {
|
|||||||
left: '50%',
|
left: '50%',
|
||||||
transform: [
|
transform: [
|
||||||
{translateX: '-50%'},
|
{translateX: '-50%'},
|
||||||
{translateX: centerColumnOffset ? -150 : 0},
|
{translateX: centerColumnOffset ? CENTER_COLUMN_OFFSET : 0},
|
||||||
...a.scrollbar_offset.transform,
|
...a.scrollbar_offset.transform,
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ import {useWebMediaQueries} from '#/lib/hooks/useWebMediaQueries'
|
|||||||
import {addStyle} from '#/lib/styles'
|
import {addStyle} from '#/lib/styles'
|
||||||
import {useLayoutBreakpoints} from '#/alf'
|
import {useLayoutBreakpoints} from '#/alf'
|
||||||
import {useDialogContext} from '#/components/Dialog'
|
import {useDialogContext} from '#/components/Dialog'
|
||||||
|
import {CENTER_COLUMN_OFFSET} from '#/components/Layout'
|
||||||
|
|
||||||
interface AddedProps {
|
interface AddedProps {
|
||||||
desktopFixedHeight?: boolean | number
|
desktopFixedHeight?: boolean | number
|
||||||
@@ -179,7 +180,7 @@ const styles = StyleSheet.create({
|
|||||||
marginRight: 'auto',
|
marginRight: 'auto',
|
||||||
},
|
},
|
||||||
containerOffset: {
|
containerOffset: {
|
||||||
transform: [{translateX: -150}],
|
transform: [{translateX: CENTER_COLUMN_OFFSET}],
|
||||||
},
|
},
|
||||||
containerScroll: {
|
containerScroll: {
|
||||||
width: '100%',
|
width: '100%',
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ import {
|
|||||||
UserCircle_Filled_Corner0_Rounded as UserCircleFilled,
|
UserCircle_Filled_Corner0_Rounded as UserCircleFilled,
|
||||||
UserCircle_Stroke2_Corner0_Rounded as UserCircle,
|
UserCircle_Stroke2_Corner0_Rounded as UserCircle,
|
||||||
} from '#/components/icons/UserCircle'
|
} from '#/components/icons/UserCircle'
|
||||||
|
import {CENTER_COLUMN_OFFSET} from '#/components/Layout'
|
||||||
import * as Menu from '#/components/Menu'
|
import * as Menu from '#/components/Menu'
|
||||||
import * as Prompt from '#/components/Prompt'
|
import * as Prompt from '#/components/Prompt'
|
||||||
import {Text} from '#/components/Typography'
|
import {Text} from '#/components/Typography'
|
||||||
@@ -559,7 +560,10 @@ export function DesktopLeftNav() {
|
|||||||
leftNavMinimal && styles.leftNavMinimal,
|
leftNavMinimal && styles.leftNavMinimal,
|
||||||
{
|
{
|
||||||
transform: [
|
transform: [
|
||||||
{translateX: centerColumnOffset ? -450 : -300},
|
{
|
||||||
|
translateX:
|
||||||
|
-300 + (centerColumnOffset ? CENTER_COLUMN_OFFSET : 0),
|
||||||
|
},
|
||||||
{translateX: '-100%'},
|
{translateX: '-100%'},
|
||||||
...a.scrollbar_offset.transform,
|
...a.scrollbar_offset.transform,
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import {
|
|||||||
} from '#/alf'
|
} from '#/alf'
|
||||||
import {AppLanguageDropdown} from '#/components/AppLanguageDropdown'
|
import {AppLanguageDropdown} from '#/components/AppLanguageDropdown'
|
||||||
import {Divider} from '#/components/Divider'
|
import {Divider} from '#/components/Divider'
|
||||||
|
import {CENTER_COLUMN_OFFSET} from '#/components/Layout'
|
||||||
import {InlineLinkText} from '#/components/Link'
|
import {InlineLinkText} from '#/components/Link'
|
||||||
import {ProgressGuideList} from '#/components/ProgressGuide/List'
|
import {ProgressGuideList} from '#/components/ProgressGuide/List'
|
||||||
import {Text} from '#/components/Typography'
|
import {Text} from '#/components/Typography'
|
||||||
@@ -66,7 +67,7 @@ export function DesktopRightNav({routeName}: {routeName: string}) {
|
|||||||
position: 'fixed',
|
position: 'fixed',
|
||||||
left: '50%',
|
left: '50%',
|
||||||
transform: [
|
transform: [
|
||||||
{translateX: centerColumnOffset ? 150 : 300},
|
{translateX: 300 + (centerColumnOffset ? CENTER_COLUMN_OFFSET : 0)},
|
||||||
...a.scrollbar_offset.transform,
|
...a.scrollbar_offset.transform,
|
||||||
],
|
],
|
||||||
width: 300 + gutters.paddingLeft,
|
width: 300 + gutters.paddingLeft,
|
||||||
|
|||||||
Reference in New Issue
Block a user