Align web gutters in dialog
This commit is contained in:
@@ -31,10 +31,10 @@ const gutters: Record<
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Gutters = {
|
type Gutters = {
|
||||||
paddingTop?: number
|
paddingTop: number
|
||||||
paddingRight?: number
|
paddingRight: number
|
||||||
paddingBottom?: number
|
paddingBottom: number
|
||||||
paddingLeft?: number
|
paddingLeft: number
|
||||||
}
|
}
|
||||||
|
|
||||||
export function useGutters([all]: [Gutter]): Gutters
|
export function useGutters([all]: [Gutter]): Gutters
|
||||||
@@ -57,16 +57,13 @@ export function useGutters([top, right, bottom, left]: Gutter[]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
paddingTop:
|
paddingTop: top === 0 ? 0 : gutters[top][activeBreakpoint || 'default'],
|
||||||
top === 0 ? undefined : gutters[top][activeBreakpoint || 'default'],
|
|
||||||
paddingRight:
|
paddingRight:
|
||||||
right === 0 ? undefined : gutters[right][activeBreakpoint || 'default'],
|
right === 0 ? 0 : gutters[right][activeBreakpoint || 'default'],
|
||||||
paddingBottom:
|
paddingBottom:
|
||||||
bottom === 0
|
bottom === 0 ? 0 : gutters[bottom][activeBreakpoint || 'default'],
|
||||||
? undefined
|
|
||||||
: gutters[bottom][activeBreakpoint || 'default'],
|
|
||||||
paddingLeft:
|
paddingLeft:
|
||||||
left === 0 ? undefined : gutters[left][activeBreakpoint || 'default'],
|
left === 0 ? 0 : gutters[left][activeBreakpoint || 'default'],
|
||||||
}
|
}
|
||||||
}, [activeBreakpoint, top, bottom, left, right])
|
}, [activeBreakpoint, top, bottom, left, right])
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,14 @@ import {RemoveScrollBar} from 'react-remove-scroll-bar'
|
|||||||
|
|
||||||
import {logger} from '#/logger'
|
import {logger} from '#/logger'
|
||||||
import {useDialogStateControlContext} from '#/state/dialogs'
|
import {useDialogStateControlContext} from '#/state/dialogs'
|
||||||
import {atoms as a, flatten, useBreakpoints, useTheme, web} from '#/alf'
|
import {
|
||||||
|
atoms as a,
|
||||||
|
flatten,
|
||||||
|
useBreakpoints,
|
||||||
|
useGutters,
|
||||||
|
useTheme,
|
||||||
|
web,
|
||||||
|
} from '#/alf'
|
||||||
import {Button, ButtonIcon} from '#/components/Button'
|
import {Button, ButtonIcon} from '#/components/Button'
|
||||||
import {Context} from '#/components/Dialog/context'
|
import {Context} from '#/components/Dialog/context'
|
||||||
import {
|
import {
|
||||||
@@ -150,8 +157,8 @@ export function Inner({
|
|||||||
contentContainerStyle,
|
contentContainerStyle,
|
||||||
}: DialogInnerProps) {
|
}: DialogInnerProps) {
|
||||||
const t = useTheme()
|
const t = useTheme()
|
||||||
|
const gutters = useGutters(['wide'])
|
||||||
const {close} = React.useContext(Context)
|
const {close} = React.useContext(Context)
|
||||||
const {gtMobile} = useBreakpoints()
|
|
||||||
useFocusGuards()
|
useFocusGuards()
|
||||||
return (
|
return (
|
||||||
<FocusScope loop asChild trapped>
|
<FocusScope loop asChild trapped>
|
||||||
@@ -188,9 +195,7 @@ export function Inner({
|
|||||||
onDismiss={close}
|
onDismiss={close}
|
||||||
style={{display: 'flex', flexDirection: 'column'}}>
|
style={{display: 'flex', flexDirection: 'column'}}>
|
||||||
{header}
|
{header}
|
||||||
<View style={[gtMobile ? a.p_2xl : a.p_xl, contentContainerStyle]}>
|
<View style={[gutters, contentContainerStyle]}>{children}</View>
|
||||||
{children}
|
|
||||||
</View>
|
|
||||||
</DismissableLayer>
|
</DismissableLayer>
|
||||||
</View>
|
</View>
|
||||||
</FocusScope>
|
</FocusScope>
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import {
|
|||||||
import {parseOfferingId} from '#/state/purchases/types'
|
import {parseOfferingId} from '#/state/purchases/types'
|
||||||
import {useSession} from '#/state/session'
|
import {useSession} from '#/state/session'
|
||||||
import * as Toast from '#/view/com/util/Toast'
|
import * as Toast from '#/view/com/util/Toast'
|
||||||
import {atoms as a, tokens, useBreakpoints, useTheme} from '#/alf'
|
import {atoms as a, tokens, useBreakpoints, useGutters,useTheme} from '#/alf'
|
||||||
import {Admonition} from '#/components/Admonition'
|
import {Admonition} from '#/components/Admonition'
|
||||||
import {Button, ButtonIcon, ButtonText} from '#/components/Button'
|
import {Button, ButtonIcon, ButtonText} from '#/components/Button'
|
||||||
import * as Dialog from '#/components/Dialog'
|
import * as Dialog from '#/components/Dialog'
|
||||||
@@ -48,6 +48,7 @@ export function BlueskyPlusCore({
|
|||||||
function DialogInner({control}: {control: Dialog.DialogControlProps}) {
|
function DialogInner({control}: {control: Dialog.DialogControlProps}) {
|
||||||
const t = useTheme()
|
const t = useTheme()
|
||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
|
const dialogGutters = useGutters(['wide'])
|
||||||
const {gtMobile} = useBreakpoints()
|
const {gtMobile} = useBreakpoints()
|
||||||
const {currentAccount} = useSession()
|
const {currentAccount} = useSession()
|
||||||
const copy = useCoreOfferingCopy()
|
const copy = useCoreOfferingCopy()
|
||||||
@@ -162,10 +163,10 @@ function DialogInner({control}: {control: Dialog.DialogControlProps}) {
|
|||||||
? undefined
|
? undefined
|
||||||
: {borderTopLeftRadius: 20, borderTopRightRadius: 20},
|
: {borderTopLeftRadius: 20, borderTopRightRadius: 20},
|
||||||
{
|
{
|
||||||
top: (a.p_xl.padding + 4) * -1,
|
top: dialogGutters.paddingTop * -1,
|
||||||
bottom: 0,
|
bottom: 0,
|
||||||
left: a.p_xl.padding * -1,
|
left: dialogGutters.paddingLeft * -1,
|
||||||
right: a.p_xl.padding * -1,
|
right: dialogGutters.paddingRight * -1,
|
||||||
},
|
},
|
||||||
]}>
|
]}>
|
||||||
<GradientFill gradient={tokens.gradients.nordic} />
|
<GradientFill gradient={tokens.gradients.nordic} />
|
||||||
|
|||||||
Reference in New Issue
Block a user