@sfgov/design-system 0.0.0-53b7e30 → 0.0.0-9aae5fe
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/css/src/base.css +26 -0
- package/css/src/components/button.css +61 -0
- package/css/src/components/details.css +10 -0
- package/css/src/components/grid.css +12 -0
- package/css/src/components/index.css +4 -0
- package/css/src/components/kbd.css +5 -0
- package/css/src/components.css +1 -0
- package/css/src/fonts.css +1 -0
- package/css/src/icons.css +7 -0
- package/css/src/overrides.css +3 -0
- package/css/src/sfds.css +6 -0
- package/css/src/theme.js +104 -0
- package/css/src/tokens/breakpoints.js +5 -0
- package/css/src/tokens/colors.js +116 -0
- package/css/src/tokens/index.js +8 -0
- package/css/src/tokens/spacing.js +27 -0
- package/css/src/tokens/typography.js +66 -0
- package/css/src/tokens/widths.js +11 -0
- package/css/src/typography.css +103 -0
- package/css/src/utilities.css +1 -0
- package/dist/manifest.json +1 -1
- package/elements/index.js +1 -0
- package/elements/index.mjs +1 -0
- package/elements/src/index.js +7 -0
- package/elements/src/sfgov-icon.js +109 -0
- package/icons/index.json +439 -0
- package/icons/svg/accessibility.svg +4 -0
- package/icons/svg/alert.svg +5 -0
- package/icons/svg/archive.svg +4 -0
- package/icons/svg/arrow-down.svg +3 -0
- package/icons/svg/arrow-left.svg +3 -0
- package/icons/svg/arrow-right.svg +3 -0
- package/icons/svg/arrow-up.svg +3 -0
- package/icons/svg/building.svg +7 -0
- package/icons/svg/calendar.svg +3 -0
- package/icons/svg/caution.svg +3 -0
- package/icons/svg/chart.svg +6 -0
- package/icons/svg/check.svg +3 -0
- package/icons/svg/chevron-down.svg +3 -0
- package/icons/svg/chevron-left.svg +3 -0
- package/icons/svg/chevron-right.svg +3 -0
- package/icons/svg/chevron-up.svg +3 -0
- package/icons/svg/clock.svg +4 -0
- package/icons/svg/close.svg +3 -0
- package/icons/svg/document.svg +3 -0
- package/icons/svg/globe.svg +3 -0
- package/icons/svg/hamburger-button.svg +5 -0
- package/icons/svg/index.json +346 -0
- package/icons/svg/info.svg +5 -0
- package/icons/svg/location.svg +4 -0
- package/icons/svg/mail.svg +3 -0
- package/icons/svg/minus.svg +3 -0
- package/icons/svg/pencil.svg +3 -0
- package/icons/svg/phone.svg +3 -0
- package/icons/svg/plus.svg +3 -0
- package/icons/svg/question.svg +4 -0
- package/icons/svg/search.svg +3 -0
- package/icons/svg/wip.svg +3 -0
- package/lib/tailwind/details.js +14 -0
- package/package.json +9 -4
- package/react/README.md +36 -0
- package/react/index.js +1 -0
- package/react/index.mjs +1 -0
- package/react/src/components/Box.tsx +6 -0
- package/react/src/components/Button.tsx +94 -0
- package/react/src/components/Container.tsx +19 -0
- package/react/src/components/Flex.tsx +16 -0
- package/react/src/components/GlobalStyle.tsx +35 -0
- package/react/src/components/GoogleFonts.tsx +67 -0
- package/react/src/components/Grid.tsx +15 -0
- package/react/src/components/SSRStyle.tsx +47 -0
- package/react/src/components/SVGIcon.tsx +42 -0
- package/react/src/components/Text.tsx +78 -0
- package/react/src/components/Tile.tsx +93 -0
- package/react/src/components/index.ts +11 -0
- package/react/src/components/page/AboutSection.tsx +90 -0
- package/react/src/components/page/AgencyHeader.tsx +56 -0
- package/react/src/components/page/ArchiveInformation.tsx +43 -0
- package/react/src/components/page/ContactSection.tsx +92 -0
- package/react/src/components/page/Section.tsx +53 -0
- package/react/src/components/page/Spotlight.tsx +70 -0
- package/react/src/components/page/index.ts +6 -0
- package/react/src/constants.ts +48 -0
- package/react/src/icons/IconAccessibility.jsx +3 -0
- package/react/src/icons/IconAlert.jsx +3 -0
- package/react/src/icons/IconArchive.jsx +3 -0
- package/react/src/icons/IconArrowDown.jsx +3 -0
- package/react/src/icons/IconArrowLeft.jsx +3 -0
- package/react/src/icons/IconArrowRight.jsx +3 -0
- package/react/src/icons/IconArrowUp.jsx +3 -0
- package/react/src/icons/IconBuilding.jsx +3 -0
- package/react/src/icons/IconCalendar.jsx +3 -0
- package/react/src/icons/IconCaution.jsx +3 -0
- package/react/src/icons/IconChart.jsx +3 -0
- package/react/src/icons/IconCheck.jsx +3 -0
- package/react/src/icons/IconChevronDown.jsx +3 -0
- package/react/src/icons/IconChevronLeft.jsx +3 -0
- package/react/src/icons/IconChevronRight.jsx +3 -0
- package/react/src/icons/IconChevronUp.jsx +3 -0
- package/react/src/icons/IconClock.jsx +3 -0
- package/react/src/icons/IconClose.jsx +3 -0
- package/react/src/icons/IconDocument.jsx +3 -0
- package/react/src/icons/IconGlobe.jsx +3 -0
- package/react/src/icons/IconHamburgerButton.jsx +3 -0
- package/react/src/icons/IconInfo.jsx +3 -0
- package/react/src/icons/IconLocation.jsx +3 -0
- package/react/src/icons/IconMail.jsx +3 -0
- package/react/src/icons/IconMinus.jsx +3 -0
- package/react/src/icons/IconPencil.jsx +3 -0
- package/react/src/icons/IconPhone.jsx +3 -0
- package/react/src/icons/IconPlus.jsx +3 -0
- package/react/src/icons/IconQuestion.jsx +3 -0
- package/react/src/icons/IconSearch.jsx +3 -0
- package/react/src/icons/IconWIP.jsx +3 -0
- package/react/src/icons/index.js +31 -0
- package/react/src/icons/index.json +346 -0
- package/react/src/icons.tsx +34 -0
- package/react/src/index.ts +4 -0
- package/react/src/stitches.config.ts +85 -0
- package/react/src/theme/breakpoints.ts +14 -0
- package/react/src/theme/colors.ts +34 -0
- package/react/src/theme/index.tsx +31 -0
- package/react/src/theme/space.ts +16 -0
- package/react/src/theme/typography.ts +136 -0
- package/react/src/types.ts +31 -0
- package/react/src/utils.tsx +25 -0
- package/tailwind.preset.js +1 -1
- package/babel.config.js +0 -16
- package/postcss.config.js +0 -17
- package/rollup.config.mjs +0 -72
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { VariantProps } from '@stitches/react'
|
|
3
|
+
import { styled, CSS } from '../stitches.config'
|
|
4
|
+
import { HOCUS_SELECTOR } from '../constants'
|
|
5
|
+
import { withFixedProps } from '../utils'
|
|
6
|
+
|
|
7
|
+
export type ButtonVariant = 'primary' | 'secondary' | 'inverse' | 'link'
|
|
8
|
+
|
|
9
|
+
const baseButtonStyles: CSS = {
|
|
10
|
+
// layout
|
|
11
|
+
display: 'inline-flex',
|
|
12
|
+
alignItems: 'center',
|
|
13
|
+
justifyItems: 'center',
|
|
14
|
+
justifyContent: 'center',
|
|
15
|
+
borderRadius: 8,
|
|
16
|
+
gap: 8,
|
|
17
|
+
px: 20,
|
|
18
|
+
py: 8,
|
|
19
|
+
// border
|
|
20
|
+
borderColor: 'transparent',
|
|
21
|
+
borderStyle: 'solid',
|
|
22
|
+
borderWidth: 3,
|
|
23
|
+
// cursor
|
|
24
|
+
cursor: 'pointer',
|
|
25
|
+
// typography
|
|
26
|
+
fontFamily: '$body',
|
|
27
|
+
fontSize: '$body',
|
|
28
|
+
lineHeight: '$body',
|
|
29
|
+
fontWeight: '$bold',
|
|
30
|
+
textAlign: 'center',
|
|
31
|
+
textDecoration: 'none',
|
|
32
|
+
whiteSpace: 'nowrap'
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const primaryButtonStyles: CSS = {
|
|
36
|
+
color: '$white',
|
|
37
|
+
backgroundColor: '$action',
|
|
38
|
+
[HOCUS_SELECTOR]: {
|
|
39
|
+
color: '$white',
|
|
40
|
+
backgroundColor: '$blueDark'
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const inverseButtonStyles: CSS = {
|
|
45
|
+
color: '$action',
|
|
46
|
+
backgroundColor: '$white',
|
|
47
|
+
[HOCUS_SELECTOR]: {
|
|
48
|
+
color: '$blueDark',
|
|
49
|
+
backgroundColor: '$white'
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const secondaryButtonStyles: CSS = {
|
|
54
|
+
...inverseButtonStyles,
|
|
55
|
+
borderColor: 'currentcolor'
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const linkButtonStyles: CSS = {
|
|
59
|
+
...inverseButtonStyles,
|
|
60
|
+
backgroundColor: 'transparent',
|
|
61
|
+
textDecoration: 'underline'
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export const Button = styled('button', {
|
|
65
|
+
...baseButtonStyles,
|
|
66
|
+
variants: {
|
|
67
|
+
variant: {
|
|
68
|
+
primary: primaryButtonStyles,
|
|
69
|
+
secondary: secondaryButtonStyles,
|
|
70
|
+
inverse: inverseButtonStyles,
|
|
71
|
+
link: linkButtonStyles
|
|
72
|
+
},
|
|
73
|
+
block: {
|
|
74
|
+
true: {
|
|
75
|
+
display: 'flex',
|
|
76
|
+
width: '100%'
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
defaultVariants: {
|
|
81
|
+
variant: 'primary'
|
|
82
|
+
}
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
export type ButtonProps = VariantProps<typeof Button>
|
|
86
|
+
|
|
87
|
+
export const PrimaryButton = createVariant('primary')
|
|
88
|
+
export const SecondaryButton = createVariant('secondary')
|
|
89
|
+
export const InverseButton = createVariant('inverse')
|
|
90
|
+
export const LinkButton = createVariant('link')
|
|
91
|
+
|
|
92
|
+
function createVariant (variant: ButtonVariant) {
|
|
93
|
+
return withFixedProps(Button, { variant })
|
|
94
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { VariantProps } from '@stitches/react'
|
|
2
|
+
import { styled } from '../stitches.config'
|
|
3
|
+
import { Box } from './Box'
|
|
4
|
+
|
|
5
|
+
export const Container = styled(Box, {
|
|
6
|
+
mx: 20,
|
|
7
|
+
maxWidth: '$lg',
|
|
8
|
+
'@md': {
|
|
9
|
+
mx: 28
|
|
10
|
+
},
|
|
11
|
+
'@lg': {
|
|
12
|
+
mx: 96
|
|
13
|
+
},
|
|
14
|
+
'@xl': {
|
|
15
|
+
mx: 'auto'
|
|
16
|
+
}
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
export type ContainerProps = VariantProps<typeof Container>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { styled } from '../stitches.config'
|
|
2
|
+
import { Box } from './Box'
|
|
3
|
+
import type { VariantProps } from '../utils'
|
|
4
|
+
|
|
5
|
+
export const Flex = styled(Box, {
|
|
6
|
+
display: 'flex',
|
|
7
|
+
variants: {
|
|
8
|
+
inline: {
|
|
9
|
+
true: {
|
|
10
|
+
display: 'inline-flex'
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
export type FlexVariant = VariantProps<typeof Flex>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React, { ComponentProps } from 'react'
|
|
2
|
+
import { getGoogleFontsCss } from './GoogleFonts'
|
|
3
|
+
import type { GlobalCSSProps } from '../types'
|
|
4
|
+
import { SSRStyle } from './SSRStyle'
|
|
5
|
+
|
|
6
|
+
export type GlobalStyleProps = Omit<ComponentProps<'style'>, 'dangerouslySetInnerHTML'> & GlobalCSSProps
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* This component renders a <style> tag that pulls in static
|
|
10
|
+
* global CSS, including Google Fonts CSS imports. For critical CSS rendered
|
|
11
|
+
* server-side, use <SSRStyle>.
|
|
12
|
+
*
|
|
13
|
+
* @see {SSRStyle}
|
|
14
|
+
* @see {getGlobalStaticCss}
|
|
15
|
+
* @param props
|
|
16
|
+
* @returns a global <style> "singleton"
|
|
17
|
+
*/
|
|
18
|
+
export function GlobalStaticStyles ({ fonts, ...rest }: GlobalStyleProps) {
|
|
19
|
+
return <style id='sfgov-global-css' {...rest} dangerouslySetInnerHTML={{
|
|
20
|
+
__html: getStaticGlobalCss({ fonts })
|
|
21
|
+
}} />
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* For static and non-React environments, use this function to generate CSS
|
|
26
|
+
* content for a global <style> element.
|
|
27
|
+
*
|
|
28
|
+
* @param props
|
|
29
|
+
* @returns
|
|
30
|
+
*/
|
|
31
|
+
export function getStaticGlobalCss (props?: GlobalCSSProps): string {
|
|
32
|
+
return [
|
|
33
|
+
getGoogleFontsCss(props?.fonts)
|
|
34
|
+
].join('')
|
|
35
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import React, { ComponentProps } from 'react'
|
|
2
|
+
import { defaultFonts } from '../constants'
|
|
3
|
+
import type { FontSpec, FontSpecProps, LinkProps } from '../types'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Render a <style> tag that imports the necessary Google Fonts for our typography.
|
|
7
|
+
* This can be used for client-side rendering, but will cause a flash of unstyled
|
|
8
|
+
* typography. If you have the ability to render server-side, please use
|
|
9
|
+
* {@link GoogleFontsPreloadStyles} or {@link SSRStyle} instead.
|
|
10
|
+
*
|
|
11
|
+
* @param props <style> props and FontSpecProps (including the `fonts` prop), plus
|
|
12
|
+
* additional CSS text as children (strings)
|
|
13
|
+
*/
|
|
14
|
+
export function GoogleFontsStylesheet ({ fonts, children, ...rest }: ComponentProps<'style'> & FontSpecProps) {
|
|
15
|
+
const url = getGoogleFontsURL(fonts)
|
|
16
|
+
return url
|
|
17
|
+
? <style {...rest}>{`@import url(${url});`}{children}</style>
|
|
18
|
+
: null
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function GoogleFontsPreloadStyles (props: FontSpecProps) {
|
|
22
|
+
return <>
|
|
23
|
+
{getGooglePreloadLinks(props.fonts).map((props, i) => (
|
|
24
|
+
<link key={i} {...props} />
|
|
25
|
+
))}
|
|
26
|
+
</>
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function getGooglePreloadLinks (fonts?: FontSpec[]): LinkProps[] {
|
|
30
|
+
const url = getGoogleFontsURL(fonts || defaultFonts)
|
|
31
|
+
if (!url) return []
|
|
32
|
+
return [
|
|
33
|
+
{ rel: 'preconnect', href: 'https://fonts.gstatic.com', crossOrigin: 'anonymous' },
|
|
34
|
+
{ rel: 'preload', as: 'style', href: url },
|
|
35
|
+
{ rel: 'stylesheet', href: url }
|
|
36
|
+
]
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function getGoogleFontsCss (fonts?: FontSpec[]) {
|
|
40
|
+
return `@import url('${getGoogleFontsURL(fonts)}');`
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function getGoogleFontsURL (fonts?: FontSpec[]) {
|
|
44
|
+
const families = (fonts || defaultFonts)
|
|
45
|
+
.map(font => [
|
|
46
|
+
font.name,
|
|
47
|
+
formatFontWeights(font)
|
|
48
|
+
])
|
|
49
|
+
.map(([family, args]) => `family=${escape(family)}${args ? `:${args}` : ''}`)
|
|
50
|
+
.join('&')
|
|
51
|
+
return `https://fonts.googleapis.com/css2?${families}&display=swap`
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function formatFontWeights (font: FontSpec) {
|
|
55
|
+
if (font.googleFont?.optical) {
|
|
56
|
+
const weights = Object.values(font.googleFont.weights)
|
|
57
|
+
.map(([range, weight]) => `${range.join('..')},${weight}`)
|
|
58
|
+
return `opsz,wght@${weights.join(';')}`
|
|
59
|
+
} else {
|
|
60
|
+
const { weights } = font
|
|
61
|
+
return `wght@${Object.values(weights).join(';')}`
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function escape (str: string) {
|
|
66
|
+
return str.replace(/ /g, '+')
|
|
67
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { styled } from '../stitches.config'
|
|
2
|
+
import { Box } from './Box'
|
|
3
|
+
import type { VariantProps } from '../utils'
|
|
4
|
+
|
|
5
|
+
export const Grid = styled(Box, {
|
|
6
|
+
display: 'grid',
|
|
7
|
+
gridTemplateColumns: 'repeat(6, minmax(0, 1fr))',
|
|
8
|
+
gap: 20,
|
|
9
|
+
'@md': {
|
|
10
|
+
gridTemplateColumns: 'repeat(12, minmax(0, 1fr))',
|
|
11
|
+
gap: 28
|
|
12
|
+
}
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
export type GridProps = VariantProps<typeof Grid>
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import React, { ComponentProps } from 'react'
|
|
2
|
+
import { getGooglePreloadLinks, GoogleFontsPreloadStyles } from './GoogleFonts'
|
|
3
|
+
import { getCssText, reset } from '../stitches.config'
|
|
4
|
+
import type { GlobalCSSProps } from '../types'
|
|
5
|
+
|
|
6
|
+
export type SSRStyleProps = Omit<ComponentProps<'style'>, 'dangerouslySetInnerHTML'> & GlobalCSSProps
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* The SSR (Server Side Render) styles component is necessary for avoiding
|
|
10
|
+
* the FOUC (Flash of Unstyled Content) when rendering server-side then
|
|
11
|
+
* hydrating on the client. It does a couple of things:
|
|
12
|
+
*
|
|
13
|
+
* 1. It adds all of the requisite <link> elements to preload Google Fonts
|
|
14
|
+
* 2. It collects any "critical path" CSS rendered by our Stitches instance
|
|
15
|
+
* (since the last call to reset(), which prevents accumulation of CSS
|
|
16
|
+
* from other pages when running in a server that renders multiple pages
|
|
17
|
+
* in the same process.
|
|
18
|
+
* 3. It renders a <style> element with the critical path CSS and passes
|
|
19
|
+
* along any additional props.
|
|
20
|
+
*
|
|
21
|
+
* The objects can also be used to generate static HTML outside of React.
|
|
22
|
+
* @param props
|
|
23
|
+
* @returns a fragment suitable for use in <head>, Helmet, next/head, etc.
|
|
24
|
+
*/
|
|
25
|
+
export function SSRStyle ({ fonts, ...rest }: SSRStyleProps) {
|
|
26
|
+
const css = getCssText()
|
|
27
|
+
reset()
|
|
28
|
+
return <>
|
|
29
|
+
<GoogleFontsPreloadStyles fonts={fonts} />
|
|
30
|
+
<style id='sfgov-ssr-css' {...rest} dangerouslySetInnerHTML={{ __html: css }} />
|
|
31
|
+
</>
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* This function returns an array of <link> element attributes (or React props)
|
|
36
|
+
* that should be included in the <head> of server-rendered documents to preload
|
|
37
|
+
* Google Fonts CSS for optimal performance and display.
|
|
38
|
+
*
|
|
39
|
+
* @param props An optional object containing a Google Fonts spec in `googleFonts`
|
|
40
|
+
* listing the fonts to be loaded.
|
|
41
|
+
* @returns an array of <link> attribute/props objects
|
|
42
|
+
*/
|
|
43
|
+
export function getPreloadLinks (props?: SSRStyleProps) {
|
|
44
|
+
return [
|
|
45
|
+
...getGooglePreloadLinks(props?.fonts)
|
|
46
|
+
]
|
|
47
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { ComponentProps, ComponentType } from 'react'
|
|
2
|
+
import { styled } from '../stitches.config'
|
|
3
|
+
import { withFixedProps } from '../utils'
|
|
4
|
+
|
|
5
|
+
export type SVGProps = ComponentProps<'svg'>
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* SVGIcon is the vehicle for SVG icon styles without the content.
|
|
9
|
+
* To render a specific SVG icon, pass it to the `as` prop as a component.
|
|
10
|
+
*/
|
|
11
|
+
export const SVGIcon = styled('svg', {
|
|
12
|
+
fill: 'currentcolor',
|
|
13
|
+
'[stroke-width]': {
|
|
14
|
+
stroke: 'currentcolor'
|
|
15
|
+
}
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
export type SVGIconProps = SVGProps & {
|
|
19
|
+
as: ComponentType<SVGProps>
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
type Size = { width: number, height: number }
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Create a styled icon component from an unstyled SVG component by wrapping it
|
|
26
|
+
* in a function that renders `<SVGIcon>` with `as={component}`.
|
|
27
|
+
*
|
|
28
|
+
* @param IconComponent the SVG component to render
|
|
29
|
+
* @param viewBox an optional array of numbers representing the visual bounding box
|
|
30
|
+
* of the SVG, e.g. `[0, 0, 20, 20]`. This sets the default `width` prop, which
|
|
31
|
+
* establishes a proportional height according to browser intrinsic aspect ratio rules.
|
|
32
|
+
*/
|
|
33
|
+
export function createStyledIcon (IconComponent: ComponentType<SVGProps>, size?: Size) {
|
|
34
|
+
const Icon = withFixedProps(SVGIcon, { as: IconComponent })
|
|
35
|
+
return Object.assign(Icon, {
|
|
36
|
+
displayName: IconComponent.displayName || IconComponent.name,
|
|
37
|
+
size,
|
|
38
|
+
defaultProps: size
|
|
39
|
+
? { width: size.width }
|
|
40
|
+
: {}
|
|
41
|
+
})
|
|
42
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import type { ComponentProps, ComponentType } from 'react'
|
|
2
|
+
import { textStyles } from '../theme/typography'
|
|
3
|
+
import { CSS, styled } from '../stitches.config'
|
|
4
|
+
import { withFixedProps, VariantProps } from '../utils'
|
|
5
|
+
|
|
6
|
+
export type TextVariant =
|
|
7
|
+
'body' | 'small' | 'bigDesc' |
|
|
8
|
+
'titleXs' | 'titleSm' | 'titleMd' | 'titleLg' | 'titleXl' |
|
|
9
|
+
'displaySm' | 'displayLg' | 'mono'
|
|
10
|
+
|
|
11
|
+
export const Text = styled('div', {
|
|
12
|
+
m: 0,
|
|
13
|
+
// Chinese text should be rendered in Noto Sans TC,
|
|
14
|
+
// with bold font weights at 500 (not 600)
|
|
15
|
+
'&:lang(zh)': {
|
|
16
|
+
fontFamily: '$chinese',
|
|
17
|
+
$fontWeights$bold: '$fontWeights$boldChinese',
|
|
18
|
+
letterSpacing: '0 !important'
|
|
19
|
+
},
|
|
20
|
+
variants: {
|
|
21
|
+
variant: {
|
|
22
|
+
body: textStyles.body,
|
|
23
|
+
small: textStyles.small,
|
|
24
|
+
bigDesc: {
|
|
25
|
+
...textStyles.bigDesc,
|
|
26
|
+
'@lg': textStyles.bigDescDesktop
|
|
27
|
+
},
|
|
28
|
+
titleXs: textStyles.titleXs,
|
|
29
|
+
titleSm: textStyles.titleSm,
|
|
30
|
+
titleMd: {
|
|
31
|
+
...textStyles.titleMd,
|
|
32
|
+
'@lg': textStyles.titleMdDesktop
|
|
33
|
+
},
|
|
34
|
+
titleLg: {
|
|
35
|
+
...textStyles.titleLg,
|
|
36
|
+
'@lg': textStyles.titleLgDesktop
|
|
37
|
+
},
|
|
38
|
+
titleXl: {
|
|
39
|
+
...textStyles.titleXl,
|
|
40
|
+
'@lg': textStyles.titleXlDesktop
|
|
41
|
+
},
|
|
42
|
+
displaySm: {
|
|
43
|
+
...textStyles.displaySm,
|
|
44
|
+
'@lg': textStyles.displaySmDesktop
|
|
45
|
+
},
|
|
46
|
+
displayLg: {
|
|
47
|
+
...textStyles.displayLg,
|
|
48
|
+
'@lg': textStyles.displayLgDesktop
|
|
49
|
+
},
|
|
50
|
+
mono: {
|
|
51
|
+
...textStyles.body,
|
|
52
|
+
fontFamily: '$monospace'
|
|
53
|
+
}
|
|
54
|
+
} as Record<TextVariant, CSS>
|
|
55
|
+
},
|
|
56
|
+
defaultVariants: {
|
|
57
|
+
variant: 'body'
|
|
58
|
+
}
|
|
59
|
+
})
|
|
60
|
+
|
|
61
|
+
export type TextProps = VariantProps<ComponentProps<typeof Text>>
|
|
62
|
+
type TextPropsNoVariant = Omit<TextProps, 'variant'>
|
|
63
|
+
|
|
64
|
+
export const BodyText = createVariant('body')
|
|
65
|
+
export const SmallText = createVariant('small')
|
|
66
|
+
export const BigDesc = createVariant('bigDesc')
|
|
67
|
+
export const TitleXs = createVariant('titleXs')
|
|
68
|
+
export const TitleSm = createVariant('titleSm')
|
|
69
|
+
export const TitleMd = createVariant('titleMd')
|
|
70
|
+
export const TitleLg = createVariant('titleLg')
|
|
71
|
+
export const TitleXl = createVariant('titleXl')
|
|
72
|
+
export const DisplaySm = createVariant('displaySm')
|
|
73
|
+
export const DisplayLg = createVariant('displayLg')
|
|
74
|
+
export const Monospace = createVariant('mono')
|
|
75
|
+
|
|
76
|
+
function createVariant (variant: TextVariant) {
|
|
77
|
+
return withFixedProps(Text, { variant }) as ComponentType<TextPropsNoVariant>
|
|
78
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react'
|
|
2
|
+
import { Flex } from './Flex'
|
|
3
|
+
import { Grid } from './Grid'
|
|
4
|
+
import { SmallText, TitleLg, TitleMd, TitleXs } from './Text'
|
|
5
|
+
import { styled } from '../stitches.config'
|
|
6
|
+
import { IconArrowRight, IconCalendar, IconDocument } from '../icons'
|
|
7
|
+
|
|
8
|
+
type TileProps = {
|
|
9
|
+
title: string;
|
|
10
|
+
body: string;
|
|
11
|
+
href: string;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
interface EventTileProps extends TileProps {
|
|
15
|
+
imgSrc?: string;
|
|
16
|
+
eventType: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const TileSection = styled(Grid, {
|
|
20
|
+
mb: 60,
|
|
21
|
+
gridTemplateColumns: 'repeat(1, minmax(0, 1fr))',
|
|
22
|
+
'@md': {
|
|
23
|
+
gridTemplateColumns: 'repeat(3, minmax(0, 1fr))'
|
|
24
|
+
}
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
const TileContainer = styled(Flex, {
|
|
28
|
+
justifyContent: 'space-between',
|
|
29
|
+
overflow: 'hidden',
|
|
30
|
+
flexDirection: 'column',
|
|
31
|
+
color: '$slateL3',
|
|
32
|
+
textDecorationLine: 'none',
|
|
33
|
+
'@md': {
|
|
34
|
+
flexDirection: 'row'
|
|
35
|
+
}
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
const ContentWrapper = styled('div', {
|
|
39
|
+
p: 20
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
const TileTitle = styled(TitleXs, {
|
|
43
|
+
mb: 20
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
const BaseTile = ({ href, children }) => (
|
|
47
|
+
<TileContainer as='a' href={href}>
|
|
48
|
+
<ContentWrapper>{children}</ContentWrapper>
|
|
49
|
+
</TileContainer>
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
export const NewsTile = ({ title, body, href }: TileProps) => (
|
|
53
|
+
<BaseTile href={href}>
|
|
54
|
+
<TileTitle>{title}</TileTitle>
|
|
55
|
+
<div>{body}</div>
|
|
56
|
+
</BaseTile>
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
export const ContentTile = ({ title, body, href }: TileProps) => (
|
|
60
|
+
<BaseTile href={href}>
|
|
61
|
+
<TileTitle>{title}</TileTitle>
|
|
62
|
+
<div>{body}</div>
|
|
63
|
+
<IconArrowRight />
|
|
64
|
+
</BaseTile>
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
export const QuickLink = ({ title, body, href }: TileProps) => (
|
|
68
|
+
<BaseTile href={href}>
|
|
69
|
+
<IconDocument />
|
|
70
|
+
<TitleLg css={{ my: 12 }}>{title}</TitleLg>
|
|
71
|
+
<div>{body}</div>
|
|
72
|
+
<IconArrowRight />
|
|
73
|
+
</BaseTile>
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
export const EventTile = ({
|
|
77
|
+
title,
|
|
78
|
+
body,
|
|
79
|
+
href,
|
|
80
|
+
imgSrc,
|
|
81
|
+
eventType
|
|
82
|
+
}: EventTileProps) => (
|
|
83
|
+
<BaseTile href={href}>
|
|
84
|
+
{/* <img src={imgSrc ? imgSrc : placeholder} /> */}
|
|
85
|
+
<div>an image will go here</div>
|
|
86
|
+
<Flex>
|
|
87
|
+
<IconCalendar />
|
|
88
|
+
<SmallText>{eventType}</SmallText>
|
|
89
|
+
</Flex>
|
|
90
|
+
<TitleMd css={{ my: 12 }}>{title}</TitleMd>
|
|
91
|
+
<div>{body}</div>
|
|
92
|
+
</BaseTile>
|
|
93
|
+
)
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from './Box'
|
|
2
|
+
export * from './Button'
|
|
3
|
+
export * from './Container'
|
|
4
|
+
export * from './Flex'
|
|
5
|
+
export * from './GlobalStyle'
|
|
6
|
+
export * from './Grid'
|
|
7
|
+
export * from './page'
|
|
8
|
+
export * from './SVGIcon'
|
|
9
|
+
export * from './SSRStyle'
|
|
10
|
+
export * from './Text'
|
|
11
|
+
export * from './Tile'
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react'
|
|
2
|
+
import { Flex } from '../Flex'
|
|
3
|
+
import { Grid } from '../Grid'
|
|
4
|
+
import { Section, SectionTitle } from './Section'
|
|
5
|
+
import { SmallText, TitleLg, TitleMd, TitleXs } from '../Text'
|
|
6
|
+
import { styled } from '../../stitches.config'
|
|
7
|
+
|
|
8
|
+
interface RelatedBodiesType {
|
|
9
|
+
id: number;
|
|
10
|
+
href: string;
|
|
11
|
+
title: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export type AboutSectionProps = {
|
|
15
|
+
about: string;
|
|
16
|
+
ctaTitle: string;
|
|
17
|
+
ctaComponent: React.ReactNode | string;
|
|
18
|
+
divisions?: RelatedBodiesType[];
|
|
19
|
+
relatedDivisions?: RelatedBodiesType[];
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const AboutContainer = styled(Flex, {
|
|
23
|
+
justifyContent: 'space-between',
|
|
24
|
+
flexDirection: 'column',
|
|
25
|
+
marginBottom: 60,
|
|
26
|
+
gap: 60,
|
|
27
|
+
'@md': {
|
|
28
|
+
flexDirection: 'row',
|
|
29
|
+
'& > *': {
|
|
30
|
+
width: '50%'
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
const FlexColumn = styled(Flex, {
|
|
36
|
+
flexDirection: 'column',
|
|
37
|
+
gap: 40
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
const BodiesSection = ({ sectionTitle, divisions }) => (
|
|
41
|
+
<div>
|
|
42
|
+
<TitleXs>{sectionTitle}</TitleXs>
|
|
43
|
+
<Flex css={{ flexWrap: 'wrap', gap: 28, marginTop: 20 }}>
|
|
44
|
+
{divisions.map((division) => (
|
|
45
|
+
<a key={division.id} href={division.href}>
|
|
46
|
+
{division.title}
|
|
47
|
+
</a>
|
|
48
|
+
))}
|
|
49
|
+
</Flex>
|
|
50
|
+
</div>
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
export const AboutSection = (args: AboutSectionProps) => (
|
|
54
|
+
<Section>
|
|
55
|
+
<SectionTitle title='About' />
|
|
56
|
+
<AboutContent {...args} />
|
|
57
|
+
</Section>
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
const AboutContent = ({
|
|
61
|
+
about,
|
|
62
|
+
ctaTitle,
|
|
63
|
+
ctaComponent,
|
|
64
|
+
divisions,
|
|
65
|
+
relatedDivisions
|
|
66
|
+
}: AboutSectionProps) => (
|
|
67
|
+
<AboutContainer>
|
|
68
|
+
<FlexColumn>
|
|
69
|
+
<TitleXs>{about}</TitleXs>
|
|
70
|
+
<div>
|
|
71
|
+
<TitleXs>{ctaTitle}</TitleXs>
|
|
72
|
+
{/*
|
|
73
|
+
For the call to action below, we should probably define
|
|
74
|
+
a series of variants (e.g. Button | SignUp | ...) to choose
|
|
75
|
+
from that are implemented in this component. We'll need to
|
|
76
|
+
know possible values from the CMS, then an API can be designed on our end.
|
|
77
|
+
*/}
|
|
78
|
+
{ctaComponent}
|
|
79
|
+
</div>
|
|
80
|
+
</FlexColumn>
|
|
81
|
+
<FlexColumn>
|
|
82
|
+
{!!divisions?.length && (
|
|
83
|
+
<BodiesSection sectionTitle='Divisions' divisions={divisions} />
|
|
84
|
+
)}
|
|
85
|
+
{!!relatedDivisions?.length && (
|
|
86
|
+
<BodiesSection sectionTitle='Related' divisions={relatedDivisions} />
|
|
87
|
+
)}
|
|
88
|
+
</FlexColumn>
|
|
89
|
+
</AboutContainer>
|
|
90
|
+
)
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { Container } from '../Container'
|
|
3
|
+
import { Flex } from '../Flex'
|
|
4
|
+
import { TitleXl } from '../Text'
|
|
5
|
+
import { IconLocation, IconPhone } from '../../icons'
|
|
6
|
+
|
|
7
|
+
interface ParentAgencyFragment {
|
|
8
|
+
id: number;
|
|
9
|
+
title: string;
|
|
10
|
+
href: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
interface ContactFragment {
|
|
14
|
+
address: string;
|
|
15
|
+
phone: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export type AgencyHeaderProps = {
|
|
19
|
+
title: string;
|
|
20
|
+
subtitle: string;
|
|
21
|
+
parentAgencies?: ParentAgencyFragment[];
|
|
22
|
+
contact: ContactFragment;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export const AgencyHeader = ({
|
|
26
|
+
title,
|
|
27
|
+
subtitle,
|
|
28
|
+
parentAgencies,
|
|
29
|
+
contact
|
|
30
|
+
}: AgencyHeaderProps) => (
|
|
31
|
+
<Container css={{ px: 20, '@md': { px: 96 } }}>
|
|
32
|
+
<TitleXl>{title}</TitleXl>
|
|
33
|
+
<div>{subtitle}</div>
|
|
34
|
+
{!!parentAgencies && (
|
|
35
|
+
<div>
|
|
36
|
+
Part of{' '}
|
|
37
|
+
{parentAgencies.map((agency, i) => [
|
|
38
|
+
i > 0 && ', ',
|
|
39
|
+
<a key={agency.id} href='#'>
|
|
40
|
+
{agency.title}
|
|
41
|
+
</a>
|
|
42
|
+
])}
|
|
43
|
+
</div>
|
|
44
|
+
)}
|
|
45
|
+
<Flex>
|
|
46
|
+
<div>
|
|
47
|
+
<IconLocation />
|
|
48
|
+
{contact.address}
|
|
49
|
+
</div>
|
|
50
|
+
<div>
|
|
51
|
+
<IconPhone />
|
|
52
|
+
{contact.phone}
|
|
53
|
+
</div>
|
|
54
|
+
</Flex>
|
|
55
|
+
</Container>
|
|
56
|
+
)
|