@telus-uds/components-web 1.2.0 → 1.4.0

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.
Files changed (140) hide show
  1. package/CHANGELOG.md +34 -2
  2. package/lib/Breadcrumbs/Breadcrumbs.js +247 -0
  3. package/lib/Breadcrumbs/Item/Item.js +165 -0
  4. package/lib/Breadcrumbs/index.js +15 -0
  5. package/lib/Callout/Callout.js +121 -0
  6. package/lib/Callout/index.js +13 -0
  7. package/lib/DatePicker/CalendarContainer.js +221 -0
  8. package/lib/DatePicker/DatePicker.js +329 -0
  9. package/lib/DatePicker/dictionary.js +134 -0
  10. package/lib/DatePicker/index.js +13 -0
  11. package/lib/DatePicker/reactDatesCss.js +12 -0
  12. package/lib/ExpandCollapseMini/ExpandCollapseMini.js +75 -0
  13. package/lib/ExpandCollapseMini/ExpandCollapseMiniControl.js +95 -0
  14. package/lib/ExpandCollapseMini/index.js +13 -0
  15. package/lib/Footnote/Footnote.js +571 -0
  16. package/lib/Footnote/FootnoteLink.js +149 -0
  17. package/lib/Footnote/dictionary.js +19 -0
  18. package/lib/Footnote/index.js +16 -0
  19. package/lib/OrderedList/Item.js +162 -0
  20. package/lib/OrderedList/ItemBase.js +42 -0
  21. package/lib/OrderedList/OrderedList.js +94 -0
  22. package/lib/OrderedList/OrderedListBase.js +68 -0
  23. package/lib/OrderedList/constants.js +9 -0
  24. package/lib/OrderedList/index.js +16 -0
  25. package/lib/PreviewCard/AuthorDate.js +64 -0
  26. package/lib/PreviewCard/PreviewCard.js +236 -0
  27. package/lib/PreviewCard/index.js +13 -0
  28. package/lib/PriceLockup/PriceLockup.js +237 -0
  29. package/lib/PriceLockup/index.js +13 -0
  30. package/lib/PriceLockup/tokens.js +131 -0
  31. package/lib/ResponsiveImage/ResponsiveImage.js +115 -0
  32. package/lib/ResponsiveImage/index.js +13 -0
  33. package/lib/Ribbon/Ribbon.js +0 -1
  34. package/lib/Span/Span.js +88 -0
  35. package/lib/Span/index.js +13 -0
  36. package/lib/index.js +91 -1
  37. package/lib/shared/FullBleedContent/FullBleedContent.js +121 -0
  38. package/lib/shared/FullBleedContent/getFullBleedBorderRadius.js +73 -0
  39. package/lib/shared/FullBleedContent/index.js +29 -0
  40. package/lib/shared/FullBleedContent/useFullBleedContentProps.js +73 -0
  41. package/lib/utils/index.js +32 -0
  42. package/lib/utils/logger.js +31 -0
  43. package/lib/utils/media.js +54 -0
  44. package/lib/utils/renderStructuredContent.js +89 -0
  45. package/lib/utils/useTypographyTheme.js +32 -0
  46. package/lib-module/Breadcrumbs/Breadcrumbs.js +228 -0
  47. package/lib-module/Breadcrumbs/Item/Item.js +141 -0
  48. package/lib-module/Breadcrumbs/index.js +1 -0
  49. package/lib-module/Callout/Callout.js +106 -0
  50. package/lib-module/Callout/index.js +2 -0
  51. package/lib-module/DatePicker/CalendarContainer.js +208 -0
  52. package/lib-module/DatePicker/DatePicker.js +302 -0
  53. package/lib-module/DatePicker/dictionary.js +127 -0
  54. package/lib-module/DatePicker/index.js +2 -0
  55. package/lib-module/DatePicker/reactDatesCss.js +3 -0
  56. package/lib-module/ExpandCollapseMini/ExpandCollapseMini.js +56 -0
  57. package/lib-module/ExpandCollapseMini/ExpandCollapseMiniControl.js +80 -0
  58. package/lib-module/ExpandCollapseMini/index.js +2 -0
  59. package/lib-module/Footnote/Footnote.js +541 -0
  60. package/lib-module/Footnote/FootnoteLink.js +130 -0
  61. package/lib-module/Footnote/dictionary.js +12 -0
  62. package/lib-module/Footnote/index.js +4 -0
  63. package/lib-module/OrderedList/Item.js +139 -0
  64. package/lib-module/OrderedList/ItemBase.js +28 -0
  65. package/lib-module/OrderedList/OrderedList.js +71 -0
  66. package/lib-module/OrderedList/OrderedListBase.js +48 -0
  67. package/lib-module/OrderedList/constants.js +2 -0
  68. package/lib-module/OrderedList/index.js +4 -0
  69. package/lib-module/PreviewCard/AuthorDate.js +53 -0
  70. package/lib-module/PreviewCard/PreviewCard.js +211 -0
  71. package/lib-module/PreviewCard/index.js +2 -0
  72. package/lib-module/PriceLockup/PriceLockup.js +213 -0
  73. package/lib-module/PriceLockup/index.js +2 -0
  74. package/lib-module/PriceLockup/tokens.js +120 -0
  75. package/lib-module/ResponsiveImage/ResponsiveImage.js +100 -0
  76. package/lib-module/ResponsiveImage/index.js +2 -0
  77. package/lib-module/Ribbon/Ribbon.js +1 -2
  78. package/lib-module/Span/Span.js +70 -0
  79. package/lib-module/Span/index.js +2 -0
  80. package/lib-module/index.js +10 -0
  81. package/lib-module/shared/FullBleedContent/FullBleedContent.js +106 -0
  82. package/lib-module/shared/FullBleedContent/getFullBleedBorderRadius.js +65 -0
  83. package/lib-module/shared/FullBleedContent/index.js +4 -0
  84. package/lib-module/shared/FullBleedContent/useFullBleedContentProps.js +65 -0
  85. package/lib-module/utils/index.js +5 -1
  86. package/lib-module/utils/logger.js +18 -0
  87. package/lib-module/utils/media.js +46 -0
  88. package/lib-module/utils/renderStructuredContent.js +77 -0
  89. package/lib-module/utils/useTypographyTheme.js +24 -0
  90. package/package.json +9 -4
  91. package/src/Breadcrumbs/Breadcrumbs.jsx +222 -0
  92. package/src/Breadcrumbs/Item/Item.jsx +127 -0
  93. package/src/Breadcrumbs/index.js +1 -0
  94. package/src/Callout/Callout.jsx +76 -0
  95. package/src/Callout/index.js +3 -0
  96. package/src/DatePicker/CalendarContainer.jsx +210 -0
  97. package/src/DatePicker/DatePicker.jsx +303 -0
  98. package/src/DatePicker/dictionary.js +92 -0
  99. package/src/DatePicker/index.js +3 -0
  100. package/src/DatePicker/reactDatesCss.js +892 -0
  101. package/src/ExpandCollapseMini/ExpandCollapseMini.jsx +48 -0
  102. package/src/ExpandCollapseMini/ExpandCollapseMiniControl.jsx +67 -0
  103. package/src/ExpandCollapseMini/index.js +3 -0
  104. package/src/Footnote/Footnote.jsx +468 -0
  105. package/src/Footnote/FootnoteLink.jsx +120 -0
  106. package/src/Footnote/dictionary.js +12 -0
  107. package/src/Footnote/index.js +6 -0
  108. package/src/OrderedList/Item.jsx +121 -0
  109. package/src/OrderedList/ItemBase.jsx +18 -0
  110. package/src/OrderedList/OrderedList.jsx +61 -0
  111. package/src/OrderedList/OrderedListBase.jsx +38 -0
  112. package/src/OrderedList/constants.js +2 -0
  113. package/src/OrderedList/index.js +6 -0
  114. package/src/PreviewCard/AuthorDate.jsx +31 -0
  115. package/src/PreviewCard/PreviewCard.jsx +201 -0
  116. package/src/PreviewCard/index.js +3 -0
  117. package/src/PriceLockup/PriceLockup.jsx +210 -0
  118. package/src/PriceLockup/index.js +3 -0
  119. package/src/PriceLockup/tokens.js +58 -0
  120. package/src/ResponsiveImage/ResponsiveImage.jsx +77 -0
  121. package/src/ResponsiveImage/index.js +3 -0
  122. package/src/Ribbon/Ribbon.jsx +0 -1
  123. package/src/Span/Span.jsx +66 -0
  124. package/src/Span/index.js +3 -0
  125. package/src/index.js +10 -0
  126. package/src/shared/FullBleedContent/FullBleedContent.jsx +90 -0
  127. package/src/shared/FullBleedContent/getFullBleedBorderRadius.js +55 -0
  128. package/src/shared/FullBleedContent/index.js +6 -0
  129. package/src/shared/FullBleedContent/useFullBleedContentProps.js +63 -0
  130. package/src/utils/index.js +5 -1
  131. package/src/utils/logger.js +20 -0
  132. package/src/utils/media.js +40 -0
  133. package/src/utils/renderStructuredContent.jsx +73 -0
  134. package/src/utils/useTypographyTheme.js +14 -0
  135. package/types/Callout.d.ts +13 -0
  136. package/types/DatePicker.d.ts +21 -0
  137. package/types/Footnote.d.ts +21 -0
  138. package/types/FootnoteLink.d.ts +20 -0
  139. package/types/PriceLockup.d.ts +22 -0
  140. package/types/common.d.ts +14 -0
@@ -0,0 +1,12 @@
1
+ export default {
2
+ en: {
3
+ a11yLabel: 'Read legal footnote',
4
+ close: 'close',
5
+ heading: 'Terms and conditions'
6
+ },
7
+ fr: {
8
+ a11yLabel: 'Lire la note de bas de page légale',
9
+ close: 'fermer',
10
+ heading: 'Modalités et conditions'
11
+ }
12
+ }
@@ -0,0 +1,6 @@
1
+ import Footnote from './Footnote'
2
+ import FootnoteLink from './FootnoteLink'
3
+
4
+ Footnote.Link = FootnoteLink
5
+
6
+ export default Footnote
@@ -0,0 +1,121 @@
1
+ import React, { forwardRef } from 'react'
2
+ import PropTypes from 'prop-types'
3
+ import styled from 'styled-components'
4
+ import {
5
+ applyTextStyles,
6
+ getTokensPropType,
7
+ selectSystemProps,
8
+ StackView,
9
+ Typography,
10
+ useTheme,
11
+ useThemeTokens,
12
+ wrapStringsInText
13
+ } from '@telus-uds/components-base'
14
+ import ItemBase from './ItemBase'
15
+ import { htmlAttrs } from '../utils'
16
+ import { OL_COUNTER_NAME } from './constants'
17
+
18
+ const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs])
19
+
20
+ const selectItemTextStyles = (
21
+ { itemFontWeight, itemFontSize, itemLineHeight, itemFontName, itemColor },
22
+ themeOptions
23
+ ) =>
24
+ applyTextStyles({
25
+ fontWeight: itemFontWeight,
26
+ fontSize: itemFontSize,
27
+ fontName: itemFontName,
28
+ color: itemColor,
29
+ themeOptions,
30
+ lineHeight: itemLineHeight
31
+ })
32
+
33
+ const StyledItemBase = styled(ItemBase)(
34
+ ({
35
+ interItemMargin,
36
+ itemBulletContainerWidth,
37
+ itemBulletContainerAlign,
38
+ itemFontWeight,
39
+ itemFontSize,
40
+ itemFontName,
41
+ itemLineHeight,
42
+ themeOptions,
43
+ listGutter,
44
+ itemColor
45
+ }) => ({
46
+ counterIncrement: OL_COUNTER_NAME,
47
+ '::before': {
48
+ content: `counter(${OL_COUNTER_NAME})'.'`,
49
+ display: 'inline-flex',
50
+ color: itemColor,
51
+ width: itemBulletContainerWidth,
52
+ paddingRight: listGutter,
53
+ textAlign: itemBulletContainerAlign,
54
+ ...applyTextStyles({
55
+ fontWeight: itemFontWeight,
56
+ fontSize: itemFontSize,
57
+ fontName: itemFontName,
58
+ themeOptions
59
+ }),
60
+ lineHeight: `${itemLineHeight * itemFontSize}px`
61
+ },
62
+ ':not(:last-child)': { marginBottom: interItemMargin }
63
+ })
64
+ )
65
+
66
+ const ItemContent = styled.div({
67
+ flex: 1
68
+ })
69
+
70
+ const Item = forwardRef(({ children, counterName, title, tokens, variant, ...rest }, ref) => {
71
+ // We are reusing some tokens from the list component here in order to provide a unified
72
+ // experience
73
+ const themeTokens = useThemeTokens('OrderedList', tokens, variant)
74
+ const headingTokens = title && {
75
+ lineHeight: themeTokens.itemLineHeight,
76
+ fontSize: themeTokens.itemFontSize,
77
+ color: themeTokens.itemColor,
78
+ fontName: themeTokens.headerFontName,
79
+ fontWeight: themeTokens.headerFontWeight
80
+ }
81
+
82
+ const { themeOptions } = useTheme()
83
+ const itemContent = wrapStringsInText(children, {
84
+ style: selectItemTextStyles(themeTokens, themeOptions)
85
+ })
86
+
87
+ return (
88
+ <StyledItemBase ref={ref} themeOptions={themeOptions} {...themeTokens} {...selectProps(rest)}>
89
+ {title ? (
90
+ <StackView tokens={{ flexShrink: 1 }} space={0}>
91
+ <Typography variant={{ size: 'h4' }} tokens={headingTokens}>
92
+ {title}
93
+ </Typography>
94
+ <ItemContent {...themeTokens}>{itemContent}</ItemContent>
95
+ </StackView>
96
+ ) : (
97
+ itemContent
98
+ )}
99
+ </StyledItemBase>
100
+ )
101
+ })
102
+ Item.displayName = 'OrderedListItem'
103
+
104
+ Item.propTypes = {
105
+ ...selectedSystemPropTypes,
106
+ /**
107
+ * Item content
108
+ */
109
+ children: PropTypes.node.isRequired,
110
+ title: PropTypes.string,
111
+ /**
112
+ * Item tokens
113
+ */
114
+ tokens: getTokensPropType('List')
115
+ }
116
+ Item.defaultProps = {
117
+ title: undefined,
118
+ tokens: {}
119
+ }
120
+
121
+ export default Item
@@ -0,0 +1,18 @@
1
+ import React from 'react'
2
+ import PropTypes from 'prop-types'
3
+ import styled from 'styled-components'
4
+
5
+ const StyledItem = styled.li({
6
+ display: 'flex'
7
+ })
8
+
9
+ const Item = ({ children, ...rest }) => <StyledItem {...rest}>{children}</StyledItem>
10
+
11
+ Item.propTypes = {
12
+ /**
13
+ * Item content
14
+ */
15
+ children: PropTypes.node.isRequired
16
+ }
17
+
18
+ export default Item
@@ -0,0 +1,61 @@
1
+ import React, { forwardRef } from 'react'
2
+ import PropTypes from 'prop-types'
3
+ import styled from 'styled-components'
4
+ import { selectSystemProps } from '@telus-uds/components-base'
5
+ import { htmlAttrs } from '../utils'
6
+ import OrderedListBase from './OrderedListBase'
7
+ import Item from './Item'
8
+ import { OL_COUNTER_NAME } from './constants'
9
+
10
+ const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs])
11
+
12
+ const StyledOrderedListBase = styled(OrderedListBase)(({ start }) => ({
13
+ // Using CSS counters here to have better control over the number styling
14
+ listStyle: 'none',
15
+ counterReset: `${OL_COUNTER_NAME} ${start - 1}`
16
+ }))
17
+
18
+ /**
19
+ * Themed semantic ordered list.
20
+ */
21
+ const OrderedList = forwardRef(({ children, start, variant, ...rest }, ref) => {
22
+ // Pass any variants "OrderedList" receives down to the individual list items.
23
+ const childrenWithParentVariants = variant
24
+ ? children.map((child) => {
25
+ const existingChildVariants = child.props?.variant ?? {}
26
+ return {
27
+ ...child,
28
+ props: {
29
+ ...child.props,
30
+ variant: {
31
+ ...existingChildVariants,
32
+ ...variant
33
+ }
34
+ }
35
+ }
36
+ })
37
+ : children
38
+ return (
39
+ <StyledOrderedListBase {...selectProps(rest)} ref={ref} start={start}>
40
+ {childrenWithParentVariants}
41
+ </StyledOrderedListBase>
42
+ )
43
+ })
44
+ OrderedList.displayName = 'OrderedList'
45
+
46
+ OrderedList.propTypes = {
47
+ ...selectedSystemPropTypes,
48
+ /**
49
+ * A list of ordered items wrapped in `OrderedList.Item`.
50
+ */
51
+ children: PropTypes.node.isRequired,
52
+ /**
53
+ * The position to start the list with.
54
+ */
55
+ start: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
56
+ }
57
+ OrderedList.defaultProps = { start: 1 }
58
+
59
+ OrderedList.Item = Item
60
+
61
+ export default OrderedList
@@ -0,0 +1,38 @@
1
+ import React, { forwardRef } from 'react'
2
+ import PropTypes from 'prop-types'
3
+ import styled from 'styled-components'
4
+ import ItemBase from './ItemBase'
5
+
6
+ const StyledList = styled.ol({
7
+ display: 'flex',
8
+ flexDirection: 'column',
9
+ listStylePosition: 'inside',
10
+ margin: 0,
11
+ padding: 0
12
+ })
13
+
14
+ /**
15
+ * Semantic ordered list.
16
+ */
17
+ const OrderedListBase = forwardRef(({ children, start, ...rest }, ref) => (
18
+ <StyledList {...rest} ref={ref} start={start}>
19
+ {children}
20
+ </StyledList>
21
+ ))
22
+ OrderedListBase.displayName = 'OrderedList'
23
+
24
+ OrderedListBase.propTypes = {
25
+ /**
26
+ * A list of ordered items wrapped in `OrderedListBase.Item`.
27
+ */
28
+ children: PropTypes.node.isRequired,
29
+ /**
30
+ * The position to start the list with.
31
+ */
32
+ start: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
33
+ }
34
+ OrderedListBase.defaultProps = { start: 1 }
35
+
36
+ OrderedListBase.Item = ItemBase
37
+
38
+ export default OrderedListBase
@@ -0,0 +1,2 @@
1
+ // eslint-disable-next-line import/prefer-default-export
2
+ export const OL_COUNTER_NAME = 'allium-ordered-list-counter'
@@ -0,0 +1,6 @@
1
+ import OrderedList from './OrderedList'
2
+ import Item from './Item'
3
+
4
+ OrderedList.Item = Item
5
+
6
+ export default OrderedList
@@ -0,0 +1,31 @@
1
+ import React from 'react'
2
+ import PropTypes from 'prop-types'
3
+
4
+ import { StackWrap, Typography, useThemeTokens } from '@telus-uds/components-base'
5
+
6
+ /**
7
+ * A footer for PreviewCard that composes author and date in a standard way
8
+ *
9
+ * @TODO
10
+ * Add same locale-based date formatting as StoryCard when ready.
11
+ * Get locale based on decision of https://github.com/telus/universal-design-system/issues/715
12
+ */
13
+ const AuthorDate = ({ author, date }) => {
14
+ const { separatorColor: color } = useThemeTokens('PreviewCard', {}, {})
15
+ return (
16
+ <StackWrap space={2}>
17
+ <Typography variant={{ size: 'small', colour: 'secondary' }}>{author}</Typography>
18
+ <Typography variant={{ size: 'small' }} tokens={{ color }}>
19
+ ·
20
+ </Typography>
21
+ <Typography variant={{ size: 'small', colour: 'secondary' }}>{date}</Typography>
22
+ </StackWrap>
23
+ )
24
+ }
25
+
26
+ AuthorDate.propTypes = {
27
+ author: PropTypes.string.isRequired,
28
+ date: PropTypes.string.isRequired
29
+ }
30
+
31
+ export default AuthorDate
@@ -0,0 +1,201 @@
1
+ /* eslint-disable react/require-default-props */
2
+ import React, { forwardRef } from 'react'
3
+ import PropTypes from 'prop-types'
4
+ import omit from 'lodash.omit'
5
+ import {
6
+ Box,
7
+ getThemeTokens,
8
+ hrefAttrsProp,
9
+ PressableCardBase,
10
+ selectSystemProps,
11
+ Spacer,
12
+ StackView,
13
+ Typography,
14
+ a11yProps,
15
+ focusHandlerProps,
16
+ viewProps,
17
+ withLinkRouter,
18
+ useTheme
19
+ } from '@telus-uds/components-base'
20
+ import styled from 'styled-components'
21
+ import FullBleedContent, {
22
+ getFullBleedBorderRadius,
23
+ useFullBleedContentProps
24
+ } from '../shared/FullBleedContent'
25
+ import AuthorDate from './AuthorDate'
26
+
27
+ // Passes React Native-oriented system props through UDS PressableCardBase
28
+ const [selectProps, selectedSystemPropTypes] = selectSystemProps([
29
+ a11yProps,
30
+ focusHandlerProps,
31
+ viewProps
32
+ ])
33
+
34
+ // Stop changes to the card's inner border width causing the size and
35
+ // apparent position of the full bleed image to change.
36
+ const FullBleedOffsetOuter = styled.div(({ borderOffset }) => ({
37
+ overflow: 'hidden',
38
+ marginTop: borderOffset * 2
39
+ }))
40
+ const FullBleedOffsetInner = styled.div(({ borderOffset }) => ({
41
+ position: 'relative',
42
+ margin: 0 - borderOffset
43
+ }))
44
+
45
+ const defaultTokens = {
46
+ minWidth: 0,
47
+ shadow: null
48
+ }
49
+
50
+ /**
51
+ * Showcase and guide users to another page, with a preview containing title and a footer.
52
+ * Whole card is interactive, width expands based on column or container.
53
+ *
54
+ * - Use `tag` to show category of content
55
+ * - Use `title` to show title of the story
56
+ * - Use `footer` to show text such as the author / date
57
+ * - Use `href` to set the target URL
58
+ * - Use `fullBleedContent` to set the thumbnail image
59
+ */
60
+ const PreviewCard = forwardRef(
61
+ (
62
+ {
63
+ tag,
64
+ title,
65
+ footer,
66
+ fullBleedImage,
67
+ fullBleedContent = fullBleedImage,
68
+ onPress,
69
+ href,
70
+ ...rest
71
+ },
72
+ ref
73
+ ) => {
74
+ const { fullBleedContentPosition, contentStackDirection, fullBleedContentProps } =
75
+ useFullBleedContentProps({
76
+ ...fullBleedContent,
77
+ position: 'bottom'
78
+ })
79
+ const {
80
+ components: { PreviewCard: theme }
81
+ } = useTheme()
82
+ const getPressableCardTokens = (cardState) => ({
83
+ ...omit(getThemeTokens(theme, {}, {}, cardState), 'separatorColor'),
84
+ ...defaultTokens
85
+ })
86
+
87
+ const { hrefAttrs, rest: unusedRest } = hrefAttrsProp.bundle(rest)
88
+
89
+ return (
90
+ <PressableCardBase
91
+ onPress={onPress}
92
+ href={href}
93
+ hrefAttrs={hrefAttrs}
94
+ tokens={getPressableCardTokens}
95
+ ref={ref}
96
+ {...selectProps(unusedRest)}
97
+ >
98
+ {(cardState) => {
99
+ const { borderRadius, borderWidth } = getPressableCardTokens(cardState)
100
+ // Stop content jumping around as border size changes
101
+ const borderOffset = borderWidth - theme.tokens.borderWidth
102
+
103
+ const fullBleedBorderRadius = getFullBleedBorderRadius(
104
+ borderRadius + borderOffset,
105
+ fullBleedContentPosition
106
+ )
107
+
108
+ return (
109
+ <StackView
110
+ direction={contentStackDirection}
111
+ tokens={{ justifyContent: 'space-between', flexGrow: 1 }}
112
+ >
113
+ <Box
114
+ horizontal={{ xs: 4, lg: 5, options: { subtract: borderOffset } }}
115
+ vertical={{ xs: 5, lg: 7, options: { subtract: borderOffset } }}
116
+ >
117
+ {Boolean(tag) && (
118
+ <>
119
+ <Typography variant={{ size: 'eyebrow', colour: 'secondary' }}>
120
+ {tag}
121
+ </Typography>
122
+ <Spacer space={2} />
123
+ </>
124
+ )}
125
+ <Typography variant={{ size: 'h4', colour: 'secondary' }}>{title}</Typography>
126
+ {Boolean(footer) && (
127
+ <>
128
+ <Spacer space={2} />
129
+ {typeof footer === 'string' ? (
130
+ <Typography variant={{ size: 'small', colour: 'secondary' }}>
131
+ {footer}
132
+ </Typography>
133
+ ) : (
134
+ footer
135
+ )}
136
+ </>
137
+ )}
138
+ </Box>
139
+ {Boolean(fullBleedContentProps.src || fullBleedContentProps.content) && (
140
+ <FullBleedOffsetOuter borderOffset={borderOffset}>
141
+ <FullBleedOffsetInner borderOffset={borderOffset}>
142
+ <FullBleedContent
143
+ borderRadius={fullBleedBorderRadius}
144
+ {...fullBleedContentProps}
145
+ />
146
+ </FullBleedOffsetInner>
147
+ </FullBleedOffsetOuter>
148
+ )}
149
+ </StackView>
150
+ )
151
+ }}
152
+ </PressableCardBase>
153
+ )
154
+ }
155
+ )
156
+
157
+ PreviewCard.displayName = 'PreviewCard'
158
+
159
+ // Provide standard author/date footer as a preset with the export
160
+ PreviewCard.AuthorDate = AuthorDate
161
+
162
+ PreviewCard.propTypes = {
163
+ ...selectedSystemPropTypes,
164
+ /**
165
+ * The URL of the story to be navigated to. Note that `Video` component does not play well when used within
166
+ * a `PreviewCard` with `href` prop set (the volume and progress sliders can be clicked but are not draggable).
167
+ * Please use `onPress` prop instead `href` to organize navigation in cases like this.
168
+ *
169
+ * @see https://github.com/telus/allium-design-system/issues/6
170
+ */
171
+ href: PropTypes.string,
172
+ /**
173
+ * Optional function to be called on press e.g. for within-page navigation.
174
+ */
175
+ onPress: PropTypes.func,
176
+ /**
177
+ * Text stating the category of the content.
178
+ */
179
+ tag: PropTypes.string,
180
+ /**
181
+ * Section containing additional information, such as author and date.
182
+ * Use `<PreviewCard.AuthorDate author={...} date={...} />` here for author and date.
183
+ */
184
+ footer: PropTypes.oneOfType([PropTypes.node, PropTypes.string]),
185
+ /**
186
+ * Text stating the title or headline of the story.
187
+ */
188
+ title: PropTypes.string.isRequired,
189
+ /**
190
+ * Full bleed image to be placed on the card, deprecated in favor of `fullBleedContent`.
191
+ *
192
+ * @deprecated
193
+ */
194
+ fullBleedImage: PropTypes.exact(FullBleedContent.propTypes || {}),
195
+ /**
196
+ * Full bleed content to be placed on the card.
197
+ */
198
+ fullBleedContent: PropTypes.exact(FullBleedContent.propTypes || {})
199
+ }
200
+
201
+ export default withLinkRouter(PreviewCard)
@@ -0,0 +1,3 @@
1
+ import PreviewCard from './PreviewCard'
2
+
3
+ export default PreviewCard