|
1 | 1 | import React from 'react'; |
2 | 2 |
|
3 | 3 | import { useEnvironment } from '../../contexts'; |
4 | | -import { Flex, Icon, Link, Text } from '../../customizables'; |
| 4 | +import { Box, Col, Flex, Icon, Link, Text } from '../../customizables'; |
| 5 | +import { useDevMode } from '../../hooks/useDevMode'; |
5 | 6 | import { LogoMark } from '../../icons'; |
6 | | -import type { PropsOfComponent } from '../../styledSystem'; |
| 7 | +import type { PropsOfComponent, ThemableCssProp } from '../../styledSystem'; |
| 8 | +import { DevModeNotice, DevModeOverlay } from '../DevModeNotice'; |
7 | 9 | import { Card } from '.'; |
8 | 10 |
|
9 | 11 | export const CardClerkAndPagesTag = React.memo( |
10 | | - React.forwardRef<HTMLDivElement, PropsOfComponent<typeof Flex> & { withFooterPages?: boolean }>((props, ref) => { |
11 | | - const { sx, withFooterPages = false, ...rest } = props; |
12 | | - const { branded } = useEnvironment().displayConfig; |
| 12 | + React.forwardRef< |
| 13 | + HTMLDivElement, |
| 14 | + PropsOfComponent<typeof Flex> & { |
| 15 | + withFooterPages?: boolean; |
| 16 | + devModeNoticeSx?: ThemableCssProp; |
| 17 | + outerSx?: ThemableCssProp; |
| 18 | + withDevOverlay?: boolean; |
| 19 | + } |
| 20 | + >((props, ref) => { |
| 21 | + const { sx, outerSx, withFooterPages = false, withDevOverlay = false, devModeNoticeSx, ...rest } = props; |
| 22 | + const { displayConfig } = useEnvironment(); |
| 23 | + const { showDevModeNotice } = useDevMode(); |
13 | 24 |
|
14 | | - if (!(branded || withFooterPages)) { |
| 25 | + if (!(displayConfig.branded || withFooterPages) && !showDevModeNotice) { |
15 | 26 | return null; |
16 | 27 | } |
17 | 28 |
|
18 | 29 | return ( |
19 | | - <Flex |
| 30 | + <Box |
20 | 31 | sx={[ |
21 | | - t => ({ |
22 | | - ':has(div:only-child)': { |
23 | | - justifyContent: 'center', |
24 | | - }, |
25 | | - justifyContent: 'space-between', |
| 32 | + { |
26 | 33 | width: '100%', |
27 | | - padding: `0 ${t.space.$8}`, |
28 | | - }), |
29 | | - sx, |
| 34 | + position: 'relative', |
| 35 | + isolation: 'isolate', |
| 36 | + }, |
| 37 | + outerSx, |
30 | 38 | ]} |
31 | | - {...rest} |
32 | | - ref={ref} |
33 | 39 | > |
34 | | - {branded && ( |
35 | | - <Flex |
36 | | - gap={1} |
37 | | - align='center' |
38 | | - justify='center' |
39 | | - sx={t => ({ color: t.colors.$colorTextSecondary })} |
40 | | - > |
41 | | - <> |
42 | | - <Text variant='buttonSmall'>Secured by</Text> |
43 | | - <LogoMarkIconLink /> |
44 | | - </> |
45 | | - </Flex> |
46 | | - )} |
| 40 | + {withDevOverlay && <DevModeOverlay gradient={0} />} |
| 41 | + <Col |
| 42 | + sx={t => ({ |
| 43 | + gap: displayConfig.branded || withFooterPages ? t.space.$2 : 0, |
| 44 | + marginLeft: 'auto', |
| 45 | + marginRight: 'auto', |
| 46 | + width: '100%', |
| 47 | + justifyContent: 'center', |
| 48 | + alignItems: 'center', |
| 49 | + zIndex: 1, |
| 50 | + position: 'relative', |
| 51 | + })} |
| 52 | + > |
| 53 | + {(displayConfig.branded || withFooterPages) && ( |
| 54 | + <Flex |
| 55 | + sx={[ |
| 56 | + { |
| 57 | + ':has(div:only-child)': { |
| 58 | + justifyContent: 'center', |
| 59 | + }, |
| 60 | + justifyContent: 'space-between', |
| 61 | + width: '100%', |
| 62 | + }, |
| 63 | + sx, |
| 64 | + ]} |
| 65 | + {...rest} |
| 66 | + ref={ref} |
| 67 | + > |
| 68 | + {displayConfig.branded && ( |
| 69 | + <Flex |
| 70 | + gap={1} |
| 71 | + align='center' |
| 72 | + justify='center' |
| 73 | + sx={t => ({ color: t.colors.$colorTextSecondary })} |
| 74 | + > |
| 75 | + <> |
| 76 | + <Text variant='buttonSmall'>Secured by</Text> |
| 77 | + <LogoMarkIconLink /> |
| 78 | + </> |
| 79 | + </Flex> |
| 80 | + )} |
| 81 | + |
| 82 | + {withFooterPages && <Card.FooterLinks />} |
| 83 | + </Flex> |
| 84 | + )} |
47 | 85 |
|
48 | | - {withFooterPages && <Card.FooterLinks />} |
49 | | - </Flex> |
| 86 | + <DevModeNotice sx={devModeNoticeSx} /> |
| 87 | + </Col> |
| 88 | + </Box> |
50 | 89 | ); |
51 | 90 | }), |
52 | 91 | ); |
|
0 commit comments