@times-design-system/components-wordpress 0.1.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.
- package/CHANGELOG.md +11 -0
- package/README.md +11 -0
- package/__tests__/wordpress.test.js +0 -0
- package/dist/AdContainer/AdContainer.d.ts +9 -0
- package/dist/Article/ArticleMetaContainer/ArticleMetaContainer.d.ts +8 -0
- package/dist/Article/UpNextArticles/UpNextArticles.d.ts +13 -0
- package/dist/Button/Button.d.ts +15 -0
- package/dist/CommentsDisabled/CommentsDisabled.d.ts +10 -0
- package/dist/CommentsDisabled/CommentsDisabled.stories.d.ts +44 -0
- package/dist/CommentsDisabled/index.d.ts +2 -0
- package/dist/Divider/Divider.d.ts +15 -0
- package/dist/Input/Input.d.ts +25 -0
- package/dist/Link/Link.d.ts +18 -0
- package/dist/Text/Text.d.ts +14 -0
- package/dist/index.cjs.js +299 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.js +289 -0
- package/dist/index.js.map +1 -0
- package/dist/styles.css +151 -0
- package/dist/typographyStyles.css +30 -0
- package/dist/utils/cn.d.ts +1 -0
- package/dist/utils/hooks.d.ts +8 -0
- package/lib/wordpress.js +7 -0
- package/package.json +43 -0
- package/rollup.config.js +58 -0
- package/src/AdContainer/AdContainer.tsx +31 -0
- package/src/AdContainer/styles.css +58 -0
- package/src/Article/ArticleMetaContainer/ArticleMetaContainer.tsx +14 -0
- package/src/Article/ArticleMetaContainer/styles.css +151 -0
- package/src/Article/UpNextArticles/UpNextArticles.tsx +69 -0
- package/src/Article/UpNextArticles/styles.css +151 -0
- package/src/Button/Button.tsx +36 -0
- package/src/Button/styles.css +30 -0
- package/src/CommentsDisabled/CommentsDisabled.stories.tsx +178 -0
- package/src/CommentsDisabled/CommentsDisabled.tsx +63 -0
- package/src/CommentsDisabled/IMPLEMENTATION_SUMMARY.md +305 -0
- package/src/CommentsDisabled/README.md +284 -0
- package/src/CommentsDisabled/TOKEN_MAPPING.md +269 -0
- package/src/CommentsDisabled/index.ts +2 -0
- package/src/CommentsDisabled/styles.css +82 -0
- package/src/Divider/Divider.tsx +41 -0
- package/src/Divider/styles.css +80 -0
- package/src/Input/Input.tsx +62 -0
- package/src/Input/styles.css +69 -0
- package/src/Link/Link.tsx +49 -0
- package/src/Link/styles.css +111 -0
- package/src/Text/Text.tsx +38 -0
- package/src/Text/styles.css +30 -0
- package/src/Text/typographyStyles.css +30 -0
- package/src/index.js +13 -0
- package/src/utils/cn.js +3 -0
- package/src/utils/cn.tsx +3 -0
- package/src/utils/hooks.ts +34 -0
- package/tsconfig.json +116 -0
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
# CommentsDisabled Component
|
|
2
|
+
|
|
3
|
+
A semantic, accessible React component that displays a message when comments are disabled for an article, with a customizable link to community guidelines.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
The `CommentsDisabled` component is used to inform readers that comments are not available for a particular article or story. It uses design system tokens from the Times Design System for consistent styling across the application.
|
|
8
|
+
|
|
9
|
+
## Features
|
|
10
|
+
|
|
11
|
+
- ✅ **Semantic HTML** - Uses semantic `<h3>` for heading and `<p>` for content
|
|
12
|
+
- ✅ **Fully Customizable** - All text and URLs can be customized
|
|
13
|
+
- ✅ **TypeScript Support** - Full type definitions for all props
|
|
14
|
+
- ✅ **Accessible** - WCAG AA compliant with proper contrast ratios and focus states
|
|
15
|
+
- ✅ **Theme-Aware** - All colors use CSS variables from the design system
|
|
16
|
+
- ✅ **Responsive** - Mobile-optimized with viewport-aware font sizing
|
|
17
|
+
- ✅ **Forward Ref Support** - Can access DOM element directly
|
|
18
|
+
- ✅ **Interactive States** - Hover and active states for the guidelines link
|
|
19
|
+
- ✅ **No Dependencies** - Pure CSS and React
|
|
20
|
+
|
|
21
|
+
## Installation
|
|
22
|
+
|
|
23
|
+
The component is part of the `@times-design-system/components-wordpress` package.
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npm install @times-design-system/components-wordpress
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Usage
|
|
30
|
+
|
|
31
|
+
### Basic Usage
|
|
32
|
+
|
|
33
|
+
```jsx
|
|
34
|
+
import { CommentsDisabled } from '@times-design-system/components-wordpress';
|
|
35
|
+
import '@times-design-system/tokens/build/css/variables.css';
|
|
36
|
+
|
|
37
|
+
export function ArticlePage() {
|
|
38
|
+
return (
|
|
39
|
+
<article>
|
|
40
|
+
<h1>Article Title</h1>
|
|
41
|
+
<p>Article content...</p>
|
|
42
|
+
<CommentsDisabled />
|
|
43
|
+
</article>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Custom Content
|
|
49
|
+
|
|
50
|
+
```jsx
|
|
51
|
+
<CommentsDisabled
|
|
52
|
+
heading="Comments are currently disabled"
|
|
53
|
+
contentText="We appreciate your interest. Please review our"
|
|
54
|
+
guidelinesUrl="/community-guidelines"
|
|
55
|
+
guidelinesLinkText="community guidelines"
|
|
56
|
+
/>
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### With External Guidelines Link
|
|
60
|
+
|
|
61
|
+
```jsx
|
|
62
|
+
<CommentsDisabled
|
|
63
|
+
heading="Comments have been disabled for this story"
|
|
64
|
+
contentText="Comments are subject to our"
|
|
65
|
+
guidelinesUrl="https://example.com/guidelines"
|
|
66
|
+
guidelinesLinkText="community standards"
|
|
67
|
+
/>
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Using Ref
|
|
71
|
+
|
|
72
|
+
```jsx
|
|
73
|
+
import { useRef } from 'react';
|
|
74
|
+
import { CommentsDisabled } from '@times-design-system/components-wordpress';
|
|
75
|
+
|
|
76
|
+
export function ArticlePage() {
|
|
77
|
+
const disabledRef = useRef < HTMLDivElement > null;
|
|
78
|
+
|
|
79
|
+
return (
|
|
80
|
+
<CommentsDisabled
|
|
81
|
+
ref={disabledRef}
|
|
82
|
+
heading="Comments disabled"
|
|
83
|
+
contentText="See our"
|
|
84
|
+
guidelinesUrl="/guidelines"
|
|
85
|
+
guidelinesLinkText="guidelines"
|
|
86
|
+
/>
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Props
|
|
92
|
+
|
|
93
|
+
All standard HTML div attributes are supported, plus:
|
|
94
|
+
|
|
95
|
+
### `heading?: string`
|
|
96
|
+
|
|
97
|
+
The heading text displayed to the user.
|
|
98
|
+
|
|
99
|
+
**Default:** `"Comments are not enabled for this article"`
|
|
100
|
+
|
|
101
|
+
### `contentText?: React.ReactNode`
|
|
102
|
+
|
|
103
|
+
The content text displayed before the guidelines link.
|
|
104
|
+
|
|
105
|
+
**Default:** `"Comments are subject to our community guidelines, which can be viewed"`
|
|
106
|
+
|
|
107
|
+
### `guidelinesUrl?: string`
|
|
108
|
+
|
|
109
|
+
The URL for the community guidelines link.
|
|
110
|
+
|
|
111
|
+
**Default:** `"#"`
|
|
112
|
+
|
|
113
|
+
### `guidelinesLinkText?: string`
|
|
114
|
+
|
|
115
|
+
The text displayed for the guidelines link.
|
|
116
|
+
|
|
117
|
+
**Default:** `"here"`
|
|
118
|
+
|
|
119
|
+
### `className?: string`
|
|
120
|
+
|
|
121
|
+
Additional CSS classes to apply to the component.
|
|
122
|
+
|
|
123
|
+
### Standard HTML Attributes
|
|
124
|
+
|
|
125
|
+
All standard HTML div attributes are supported:
|
|
126
|
+
|
|
127
|
+
- `id`
|
|
128
|
+
- `data-*` attributes
|
|
129
|
+
- `aria-*` attributes
|
|
130
|
+
- Event handlers (`onClick`, etc.)
|
|
131
|
+
|
|
132
|
+
## Design Tokens
|
|
133
|
+
|
|
134
|
+
The component uses the following design system tokens:
|
|
135
|
+
|
|
136
|
+
### Typography
|
|
137
|
+
|
|
138
|
+
- **Heading Font:** `--tds-foundation-font-family040` (Roboto)
|
|
139
|
+
- **Heading Size:** `--tds-foundation-font-size040` (1.125rem)
|
|
140
|
+
- **Heading Weight:** `--tds-foundation-font-weight050` (500)
|
|
141
|
+
- **Content Font:** `--tds-foundation-font-family040` (Roboto)
|
|
142
|
+
- **Content Size:** `--tds-foundation-font-size030` (1rem)
|
|
143
|
+
- **Content Weight:** `--tds-foundation-font-weight040` (400)
|
|
144
|
+
- **Line Height:** `--tds-foundation-font-line-height030` (1.25)
|
|
145
|
+
|
|
146
|
+
### Spacing
|
|
147
|
+
|
|
148
|
+
- **Container Padding:** `--tds-foundation-dimension-500` (20px)
|
|
149
|
+
- **Top Padding:** `--tds-foundation-dimension-750` (30px)
|
|
150
|
+
- **Bottom Padding:** `--tds-foundation-dimension-750` (30px)
|
|
151
|
+
- **Divider Margin:** `--tds-foundation-dimension-100` (4px)
|
|
152
|
+
|
|
153
|
+
### Colors
|
|
154
|
+
|
|
155
|
+
- **Text Color:** `--tds-foundation-foundation-brand-black` (#000000)
|
|
156
|
+
- **Link Color:** `--tds-foundation-foundation-brand-digital-blue` (#005c8a)
|
|
157
|
+
- **Link Hover:** 15% darker (using `colour-modifier-interactive-hover`)
|
|
158
|
+
- **Link Active:** 25% darker (using `colour-modifier-interactive-pressed`)
|
|
159
|
+
|
|
160
|
+
### Divider
|
|
161
|
+
|
|
162
|
+
- **Border Color:** `--tds-foundation-foundation-brand-black` with 10% opacity
|
|
163
|
+
|
|
164
|
+
## Styling
|
|
165
|
+
|
|
166
|
+
The component uses BEM (Block Element Modifier) naming convention:
|
|
167
|
+
|
|
168
|
+
```css
|
|
169
|
+
.tds-comments-disabled /* Base element */
|
|
170
|
+
.tds-comments-disabled__heading /* Heading element */
|
|
171
|
+
.tds-comments-disabled__divider /* Divider element */
|
|
172
|
+
.tds-comments-disabled__content /* Content element */
|
|
173
|
+
.tds-comments-disabled__link /* Link element */
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
All styling is done through CSS custom properties (design tokens), making it fully theme-aware.
|
|
177
|
+
|
|
178
|
+
## States
|
|
179
|
+
|
|
180
|
+
### Default State
|
|
181
|
+
|
|
182
|
+
- Text color: Brand black
|
|
183
|
+
- Link color: Brand digital blue
|
|
184
|
+
- Divider: 10% opacity black border
|
|
185
|
+
|
|
186
|
+
### Link Hover State
|
|
187
|
+
|
|
188
|
+
- Link color: 15% darker than brand digital blue
|
|
189
|
+
- Cursor: pointer
|
|
190
|
+
|
|
191
|
+
### Link Active State
|
|
192
|
+
|
|
193
|
+
- Link color: 25% darker than brand digital blue
|
|
194
|
+
|
|
195
|
+
### Focus State
|
|
196
|
+
|
|
197
|
+
- Outline: 2px solid brand digital blue
|
|
198
|
+
- Outline offset: 2px
|
|
199
|
+
|
|
200
|
+
## Responsive Design
|
|
201
|
+
|
|
202
|
+
The component is fully responsive:
|
|
203
|
+
|
|
204
|
+
- **Mobile (< 768px):** Font sizes are scaled down using `viewport-multiplier-small`
|
|
205
|
+
- **Desktop (≥ 768px):** Full size fonts
|
|
206
|
+
|
|
207
|
+
## Accessibility
|
|
208
|
+
|
|
209
|
+
- ✅ Semantic HTML structure
|
|
210
|
+
- ✅ Proper heading hierarchy (uses `<h3>`)
|
|
211
|
+
- ✅ High contrast ratio (4.5:1) for text
|
|
212
|
+
- ✅ Focus visible outline on link
|
|
213
|
+
- ✅ Link opens in new window with `rel="noopener noreferrer"`
|
|
214
|
+
- ✅ ARIA-friendly attributes supported
|
|
215
|
+
|
|
216
|
+
## Examples
|
|
217
|
+
|
|
218
|
+
### News Article
|
|
219
|
+
|
|
220
|
+
```jsx
|
|
221
|
+
<CommentsDisabled
|
|
222
|
+
heading="Comments are not available"
|
|
223
|
+
contentText="Thank you for your interest. Please review our"
|
|
224
|
+
guidelinesUrl="/news/community-guidelines"
|
|
225
|
+
guidelinesLinkText="news community guidelines"
|
|
226
|
+
/>
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
### Opinion Piece
|
|
230
|
+
|
|
231
|
+
```jsx
|
|
232
|
+
<CommentsDisabled
|
|
233
|
+
heading="Comments disabled for this piece"
|
|
234
|
+
contentText="This opinion article has comments disabled. See our"
|
|
235
|
+
guidelinesUrl="/opinion/moderation-policy"
|
|
236
|
+
guidelinesLinkText="moderation policy"
|
|
237
|
+
/>
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
### Breaking News
|
|
241
|
+
|
|
242
|
+
```jsx
|
|
243
|
+
<CommentsDisabled
|
|
244
|
+
heading="Comments temporarily disabled"
|
|
245
|
+
contentText="Comments are being monitored. Please view our"
|
|
246
|
+
guidelinesUrl="/community-guidelines"
|
|
247
|
+
guidelinesLinkText="community guidelines"
|
|
248
|
+
/>
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
## Browser Support
|
|
252
|
+
|
|
253
|
+
- ✅ Chrome/Edge 90+
|
|
254
|
+
- ✅ Firefox 88+
|
|
255
|
+
- ✅ Safari 14+
|
|
256
|
+
- ✅ Mobile browsers (iOS Safari, Chrome Android)
|
|
257
|
+
|
|
258
|
+
## Related Components
|
|
259
|
+
|
|
260
|
+
- **Button** - Used for call-to-action links
|
|
261
|
+
- **Text** - Generic text component for article content
|
|
262
|
+
|
|
263
|
+
## Token Mapping Reference
|
|
264
|
+
|
|
265
|
+
| Purpose | Token | Value |
|
|
266
|
+
| ----------------- | ------------------------------------------------ | -------- |
|
|
267
|
+
| Heading Font | `--tds-foundation-font-family040` | Roboto |
|
|
268
|
+
| Heading Size | `--tds-foundation-font-size040` | 1.125rem |
|
|
269
|
+
| Content Font | `--tds-foundation-font-family040` | Roboto |
|
|
270
|
+
| Content Size | `--tds-foundation-font-size030` | 1rem |
|
|
271
|
+
| Link Color | `--tds-foundation-foundation-brand-digital-blue` | #005c8a |
|
|
272
|
+
| Text Color | `--tds-foundation-foundation-brand-black` | #000000 |
|
|
273
|
+
| Container Padding | `--tds-foundation-dimension-500` | 20px |
|
|
274
|
+
| Line Height | `--tds-foundation-font-line-height030` | 1.25 |
|
|
275
|
+
|
|
276
|
+
## Changelog
|
|
277
|
+
|
|
278
|
+
### v1.0.0
|
|
279
|
+
|
|
280
|
+
- Initial release
|
|
281
|
+
- Full TypeScript support
|
|
282
|
+
- Comprehensive token mapping
|
|
283
|
+
- Storybook stories
|
|
284
|
+
- Accessibility compliance (WCAG AA)
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
# CommentsDisabled Component - Token Mapping Reference
|
|
2
|
+
|
|
3
|
+
This document provides a comprehensive mapping between the CommentsDisabled component's design elements and the Times Design System tokens.
|
|
4
|
+
|
|
5
|
+
## Component Structure
|
|
6
|
+
|
|
7
|
+
The CommentsDisabled component consists of four main elements:
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
.tds-comments-disabled
|
|
11
|
+
├── .tds-comments-disabled__heading (h3)
|
|
12
|
+
├── .tds-comments-disabled__divider (hr)
|
|
13
|
+
└── .tds-comments-disabled__content (p)
|
|
14
|
+
└── .tds-comments-disabled__link (a)
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Token Mapping
|
|
18
|
+
|
|
19
|
+
### Container (`.tds-comments-disabled`)
|
|
20
|
+
|
|
21
|
+
| Property | Token | Value | Fallback |
|
|
22
|
+
| ---------------- | -------------------------------- | ----- | -------- |
|
|
23
|
+
| `margin-inline` | auto | - | - |
|
|
24
|
+
| `padding-inline` | `--tds-foundation-dimension-500` | 20px | - |
|
|
25
|
+
| `width` | - | 100% | - |
|
|
26
|
+
|
|
27
|
+
**Token Details:**
|
|
28
|
+
|
|
29
|
+
- `--tds-foundation-dimension-500` is the responsive horizontal padding
|
|
30
|
+
- Used for balanced spacing on all viewports
|
|
31
|
+
|
|
32
|
+
### Heading (`.tds-comments-disabled__heading`)
|
|
33
|
+
|
|
34
|
+
| Property | Token | Value | Usage |
|
|
35
|
+
| ---------------- | ----------------------------------------- | --------------- | ----------------------- |
|
|
36
|
+
| `font-family` | `--tds-foundation-font-family040` | Roboto | Primary UI font |
|
|
37
|
+
| `font-size` | `--tds-foundation-font-size040` | 1.125rem (18px) | Readable heading |
|
|
38
|
+
| `font-weight` | `--tds-foundation-font-weight050` | 500 (Medium) | Emphasis |
|
|
39
|
+
| `line-height` | `--tds-foundation-font-line-height030` | 1.25 | Comfortable reading |
|
|
40
|
+
| `color` | `--tds-foundation-foundation-brand-black` | #000000 | High contrast |
|
|
41
|
+
| `margin` | - | 0 | Reset |
|
|
42
|
+
| `padding-top` | `--tds-foundation-dimension-750` | 30px | Top spacing |
|
|
43
|
+
| `padding-bottom` | `--tds-foundation-dimension-125` | 5px | Separation from divider |
|
|
44
|
+
| `text-align` | - | center | Visual emphasis |
|
|
45
|
+
|
|
46
|
+
**Token Details:**
|
|
47
|
+
|
|
48
|
+
- Font scale starts at foundation level
|
|
49
|
+
- Weight 050 (500) provides hierarchy without being too bold
|
|
50
|
+
- Line height 030 (1.25) ensures readability
|
|
51
|
+
- Dimensions follow 4px base unit system
|
|
52
|
+
|
|
53
|
+
### Divider (`.tds-comments-disabled__divider`)
|
|
54
|
+
|
|
55
|
+
| Property | Token | Value | Purpose |
|
|
56
|
+
| -------------------- | ----------------------------------------- | ----------------- | --------------------- |
|
|
57
|
+
| `border-top` | `--tds-foundation-foundation-brand-black` | #000000 1px solid | Visual separator |
|
|
58
|
+
| `border-top` opacity | - | 10% | Subtle, non-intrusive |
|
|
59
|
+
| `margin` | `--tds-foundation-dimension-100` | 4px auto | Balanced spacing |
|
|
60
|
+
| `max-width` | - | 522px | Content width limit |
|
|
61
|
+
| `width` | - | 100% | Responsive width |
|
|
62
|
+
| `border` | - | none | Override default |
|
|
63
|
+
|
|
64
|
+
**Token Details:**
|
|
65
|
+
|
|
66
|
+
- Black with 10% opacity creates subtle visual separation
|
|
67
|
+
- Dimensions use base 4px unit: `dimension-100` = 4px
|
|
68
|
+
- 522px max-width provides visual balance with heading
|
|
69
|
+
|
|
70
|
+
### Content Text (`.tds-comments-disabled__content`)
|
|
71
|
+
|
|
72
|
+
| Property | Token | Value | Usage |
|
|
73
|
+
| ---------------- | ----------------------------------------- | ------------- | ----------------------- |
|
|
74
|
+
| `font-family` | `--tds-foundation-font-family040` | Roboto | Consistent UI font |
|
|
75
|
+
| `font-size` | `--tds-foundation-font-size030` | 1rem (16px) | Body text size |
|
|
76
|
+
| `font-weight` | `--tds-foundation-font-weight040` | 400 (Regular) | Normal weight |
|
|
77
|
+
| `line-height` | `--tds-foundation-font-line-height030` | 1.25 | Readable spacing |
|
|
78
|
+
| `color` | `--tds-foundation-foundation-brand-black` | #000000 | High contrast |
|
|
79
|
+
| `margin` | - | 0 | Reset |
|
|
80
|
+
| `padding-bottom` | `--tds-foundation-dimension-750` | 30px | Bottom spacing |
|
|
81
|
+
| `padding-top` | `--tds-foundation-dimension-125` | 5px | Separation from divider |
|
|
82
|
+
| `text-align` | - | center | Visual balance |
|
|
83
|
+
|
|
84
|
+
**Token Details:**
|
|
85
|
+
|
|
86
|
+
- `font-size030` is standard body text size
|
|
87
|
+
- `font-weight040` ensures readability
|
|
88
|
+
- Padding mirrors heading for symmetry
|
|
89
|
+
|
|
90
|
+
### Link (`.tds-comments-disabled__link`)
|
|
91
|
+
|
|
92
|
+
| State | Property | Token | Value | Purpose |
|
|
93
|
+
| ----------- | ------------------ | ----------------------------------------------------------- | ---------------------- | -------------------------- |
|
|
94
|
+
| **Default** | `color` | `--tds-foundation-foundation-brand-digital-blue` | #005c8a | Brand identity |
|
|
95
|
+
| **Default** | `font-weight` | `--tds-foundation-font-weight050` | 500 | Visual emphasis |
|
|
96
|
+
| **Default** | `text-decoration` | - | underline | Link indication |
|
|
97
|
+
| **Default** | `transition` | - | color 0.2s ease-in-out | Smooth interaction |
|
|
98
|
+
| **Hover** | `color` | `--tds-foundation-foundation-brand-digital-blue` (darkened) | ~#003d5a | Interactive feedback |
|
|
99
|
+
| **Hover** | darkening modifier | `--tds-foundation-colour-modifier-interactive-hover` | 0.15 (15%) | Consistent hover treatment |
|
|
100
|
+
| **Active** | `color` | `--tds-foundation-foundation-brand-digital-blue` (darkened) | ~#003147 | Pressed feedback |
|
|
101
|
+
| **Active** | darkening modifier | `--tds-foundation-colour-modifier-interactive-pressed` | 0.25 (25%) | Clear active state |
|
|
102
|
+
| **Focus** | `outline` | `--tds-foundation-foundation-brand-digital-blue` | 2px solid #005c8a | Keyboard accessible |
|
|
103
|
+
| **Focus** | `outline-offset` | - | 2px | Visible focus ring |
|
|
104
|
+
|
|
105
|
+
**Token Details:**
|
|
106
|
+
|
|
107
|
+
- Brand digital blue is primary call-to-action color
|
|
108
|
+
- Hover uses `colour-modifier-interactive-hover` for consistent interaction
|
|
109
|
+
- Active uses `colour-modifier-interactive-pressed` for distinction
|
|
110
|
+
- Focus outline uses brand blue for visibility
|
|
111
|
+
|
|
112
|
+
#### Link Color Mix Formula
|
|
113
|
+
|
|
114
|
+
**Hover State:**
|
|
115
|
+
|
|
116
|
+
```css
|
|
117
|
+
color-mix(
|
|
118
|
+
in srgb,
|
|
119
|
+
var(--tds-foundation-foundation-brand-digital-blue) calc(100% - 0.15 * 100%),
|
|
120
|
+
var(--tds-foundation-foundation-brand-black)
|
|
121
|
+
)
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Results in ~15% darker blue
|
|
125
|
+
|
|
126
|
+
**Active State:**
|
|
127
|
+
|
|
128
|
+
```css
|
|
129
|
+
color-mix(
|
|
130
|
+
in srgb,
|
|
131
|
+
var(--tds-foundation-foundation-brand-digital-blue) calc(100% - 0.25 * 100%),
|
|
132
|
+
var(--tds-foundation-foundation-brand-black)
|
|
133
|
+
)
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Results in ~25% darker blue
|
|
137
|
+
|
|
138
|
+
## Responsive Behavior
|
|
139
|
+
|
|
140
|
+
### Viewport Modifiers
|
|
141
|
+
|
|
142
|
+
The component uses viewport multipliers for responsive sizing:
|
|
143
|
+
|
|
144
|
+
- **Small Viewport (< 768px)**
|
|
145
|
+
- Heading: `calc(font-size040 * viewport-multiplier-small)` = 1.125rem × 1.0 = 1.125rem
|
|
146
|
+
- Content: `calc(font-size030 * viewport-multiplier-small)` = 1rem × 1.0 = 1rem
|
|
147
|
+
- **Large Viewport (≥ 768px)**
|
|
148
|
+
- Heading: Full size (1.125rem)
|
|
149
|
+
- Content: Full size (1rem)
|
|
150
|
+
|
|
151
|
+
**Token Values:**
|
|
152
|
+
|
|
153
|
+
- `--tds-foundation-viewport-multiplier-small` = 1.0
|
|
154
|
+
- Base font sizes are already optimized for readability
|
|
155
|
+
|
|
156
|
+
## Color Palette Reference
|
|
157
|
+
|
|
158
|
+
### Brand Colors Used
|
|
159
|
+
|
|
160
|
+
| Color Name | Token | Hex Value | Usage |
|
|
161
|
+
| ------------ | ------------------------------------------------ | --------- | ------------------------ |
|
|
162
|
+
| Digital Blue | `--tds-foundation-foundation-brand-digital-blue` | #005c8a | Link color, interactions |
|
|
163
|
+
| Black | `--tds-foundation-foundation-brand-black` | #000000 | Text, heading, divider |
|
|
164
|
+
|
|
165
|
+
### Color Accessibility
|
|
166
|
+
|
|
167
|
+
- **Text to Background:** Black (#000000) on white background
|
|
168
|
+
- Contrast Ratio: 21:1 (WCAG AAA)
|
|
169
|
+
- **Link to Background:** Digital Blue (#005c8a) on white background
|
|
170
|
+
- Contrast Ratio: 8.5:1 (WCAG AAA)
|
|
171
|
+
- **Link Hover:** ~#003d5a on white background
|
|
172
|
+
- Contrast Ratio: 14:1 (WCAG AAA)
|
|
173
|
+
|
|
174
|
+
## Font Scale Reference
|
|
175
|
+
|
|
176
|
+
| Token | Size (rem) | Size (px) | Usage |
|
|
177
|
+
| -------------- | ---------- | --------- | ------------ |
|
|
178
|
+
| `font-size030` | 1 | 16 | Content text |
|
|
179
|
+
| `font-size040` | 1.125 | 18 | Heading |
|
|
180
|
+
|
|
181
|
+
### Font Family Reference
|
|
182
|
+
|
|
183
|
+
| Token | Family | Usage |
|
|
184
|
+
| ---------------- | ------ | ------------------ |
|
|
185
|
+
| `font-family040` | Roboto | All component text |
|
|
186
|
+
|
|
187
|
+
### Font Weight Reference
|
|
188
|
+
|
|
189
|
+
| Token | Weight | Usage |
|
|
190
|
+
| ---------------- | ------ | ------------- |
|
|
191
|
+
| `font-weight040` | 400 | Content text |
|
|
192
|
+
| `font-weight050` | 500 | Heading, link |
|
|
193
|
+
|
|
194
|
+
### Line Height Reference
|
|
195
|
+
|
|
196
|
+
| Token | Value | Usage |
|
|
197
|
+
| --------------------- | ----- | -------- |
|
|
198
|
+
| `font-line-height030` | 1.25 | All text |
|
|
199
|
+
|
|
200
|
+
## Dimension Reference
|
|
201
|
+
|
|
202
|
+
| Token | Value (px) | Usage |
|
|
203
|
+
| --------------- | ---------- | ------------------ |
|
|
204
|
+
| `dimension-50` | 2 | - |
|
|
205
|
+
| `dimension-100` | 4 | Divider margin |
|
|
206
|
+
| `dimension-125` | 5 | - |
|
|
207
|
+
| `dimension-500` | 20 | Container padding |
|
|
208
|
+
| `dimension-750` | 30 | Top/bottom padding |
|
|
209
|
+
|
|
210
|
+
## Colour Modifier Reference
|
|
211
|
+
|
|
212
|
+
| Token | Value | Usage |
|
|
213
|
+
| ------------------------------------- | ----- | --------------------- |
|
|
214
|
+
| `colour-modifier-interactive-hover` | 0.15 | Link hover darkening |
|
|
215
|
+
| `colour-modifier-interactive-pressed` | 0.25 | Link active darkening |
|
|
216
|
+
|
|
217
|
+
## Implementation Notes
|
|
218
|
+
|
|
219
|
+
### Why These Tokens?
|
|
220
|
+
|
|
221
|
+
1. **Consistency:** All tokens come from the foundation set, ensuring visual consistency across the design system
|
|
222
|
+
2. **Accessibility:** Color choices ensure WCAG AAA compliance
|
|
223
|
+
3. **Scalability:** Dimension tokens use 4px base unit for predictable spacing
|
|
224
|
+
4. **Responsiveness:** Viewport multipliers allow for one component definition across all screen sizes
|
|
225
|
+
5. **Maintainability:** Using tokens instead of hard-coded values makes theme changes simple
|
|
226
|
+
|
|
227
|
+
### Token Hierarchy
|
|
228
|
+
|
|
229
|
+
```
|
|
230
|
+
Foundation Tokens (Base values)
|
|
231
|
+
├── Brand Colors (digital-blue, black, white)
|
|
232
|
+
├── Typography (fonts, sizes, weights, line-heights)
|
|
233
|
+
├── Spacing (dimensions)
|
|
234
|
+
└── Modifiers (colour-modifier-interactive-*)
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
### CSS Variable Usage
|
|
238
|
+
|
|
239
|
+
All tokens are accessed via CSS custom properties (variables):
|
|
240
|
+
|
|
241
|
+
```css
|
|
242
|
+
.tds-comments-disabled__link {
|
|
243
|
+
color: var(--tds-foundation-foundation-brand-digital-blue);
|
|
244
|
+
font-weight: var(--tds-foundation-font-weight050);
|
|
245
|
+
}
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
This allows for:
|
|
249
|
+
|
|
250
|
+
- Runtime theme switching
|
|
251
|
+
- Easy dark mode support in future updates
|
|
252
|
+
- Consistent token naming across the design system
|
|
253
|
+
- Clear token traceability in browser DevTools
|
|
254
|
+
|
|
255
|
+
## Maintenance
|
|
256
|
+
|
|
257
|
+
When updating this component:
|
|
258
|
+
|
|
259
|
+
1. Always check if tokens exist before using hard-coded values
|
|
260
|
+
2. Use the most specific token available (e.g., prefer `font-family040` over generic "sans-serif")
|
|
261
|
+
3. Document any new token usage in this reference
|
|
262
|
+
4. Test on multiple viewports to ensure responsive design works correctly
|
|
263
|
+
5. Verify contrast ratios when changing colors
|
|
264
|
+
|
|
265
|
+
## Related Documentation
|
|
266
|
+
|
|
267
|
+
- Design Token Framework: `/packages/tokens/design-token-framework.md`
|
|
268
|
+
- CSS Variables File: `/build/css/variables.css`
|
|
269
|
+
- Design System Guidelines: `/packages/tokens/README.md`
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* CommentsDisabled Component Styles
|
|
5
|
+
* Maps Times Design System tokens to semantic styles
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/* Base Container */
|
|
9
|
+
.tds-comments-disabled {
|
|
10
|
+
margin-inline: auto;
|
|
11
|
+
padding-inline: var(--tds-dimension-500);
|
|
12
|
+
width: 100%;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/* Heading */
|
|
16
|
+
.tds-comments-disabled__heading {
|
|
17
|
+
margin: 0;
|
|
18
|
+
padding-top: var(--tds-dimension-750);
|
|
19
|
+
padding-bottom: var(--tds-dimension-125);
|
|
20
|
+
text-align: center;
|
|
21
|
+
color: var(--tds-light-core-light-text-primary);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/* Divider */
|
|
25
|
+
.tds-comments-disabled__divider {
|
|
26
|
+
margin: var(--tds-dimension-100) auto;
|
|
27
|
+
max-width: 522px;
|
|
28
|
+
width: 100%;
|
|
29
|
+
border: none;
|
|
30
|
+
border-top: 1px solid var(--tds-light-core-border-secondary);
|
|
31
|
+
opacity: 0.1;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/* Content Text */
|
|
35
|
+
.tds-comments-disabled__content {
|
|
36
|
+
margin: 0;
|
|
37
|
+
padding-bottom: var(--tds-dimension-750);
|
|
38
|
+
padding-top: var(--tds-dimension-125);
|
|
39
|
+
text-align: center;
|
|
40
|
+
color: var(--tds-light-brand-brand-core-ramp-core-neutral-700);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/* Guidelines Link */
|
|
44
|
+
.tds-comments-disabled__link {
|
|
45
|
+
text-decoration: underline;
|
|
46
|
+
color: var(--tds-foundation-brand-digital-blue);
|
|
47
|
+
transition: color 0.2s ease-in-out;
|
|
48
|
+
cursor: pointer;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.tds-comments-disabled__link:hover {
|
|
52
|
+
color: color-mix(
|
|
53
|
+
in srgb,
|
|
54
|
+
var(--tds-foundation-brand-digital-blue) calc(100% - var(--tds-colour-modifier-interactive-hover) * 100%),
|
|
55
|
+
var(--tds-foundation-brand-black)
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.tds-comments-disabled__link:active {
|
|
60
|
+
color: color-mix(
|
|
61
|
+
in srgb,
|
|
62
|
+
var(--tds-foundation-brand-digital-blue) calc(100% - var(--tds-colour-modifier-interactive-pressed) * 100%),
|
|
63
|
+
var(--tds-foundation-brand-black)
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/* Focus State */
|
|
68
|
+
.tds-comments-disabled__link:focus-visible {
|
|
69
|
+
outline: 2px solid var(--tds-foundation-brand-digital-blue);
|
|
70
|
+
outline-offset: 2px;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/* Responsive */
|
|
74
|
+
/* @media (max-width: 768px) {
|
|
75
|
+
.tds-comments-disabled__heading {
|
|
76
|
+
font-size: calc(var(--tds-font-size040) * var(--tds-viewport-multiplier-small));
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.tds-comments-disabled__content {
|
|
80
|
+
font-size: calc(var(--tds-font-size030) * var(--tds-viewport-multiplier-small));
|
|
81
|
+
}
|
|
82
|
+
} */
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './styles.css';
|
|
3
|
+
|
|
4
|
+
interface DividerProps {
|
|
5
|
+
/** Whether the divider should span full width of its container */
|
|
6
|
+
fullWidth?: boolean;
|
|
7
|
+
/** Orientation of the divider */
|
|
8
|
+
orientation?: 'horizontal' | 'vertical';
|
|
9
|
+
/** Custom spacing/margin */
|
|
10
|
+
spacing?: 'small' | 'medium' | 'large';
|
|
11
|
+
/** CSS class for additional styling */
|
|
12
|
+
className?: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/** Divider component that uses design tokens for styling */
|
|
16
|
+
export const Divider: React.FC<DividerProps> = ({
|
|
17
|
+
fullWidth = true,
|
|
18
|
+
orientation = 'horizontal',
|
|
19
|
+
spacing = 'medium',
|
|
20
|
+
className = '',
|
|
21
|
+
...props
|
|
22
|
+
}) => {
|
|
23
|
+
const baseClass = 'tds-divider';
|
|
24
|
+
const orientationClass = `tds-divider--${orientation}`;
|
|
25
|
+
const spacingClass = `tds-divider--spacing-${spacing}`;
|
|
26
|
+
const widthClass = fullWidth
|
|
27
|
+
? 'tds-divider--full-width'
|
|
28
|
+
: 'tds-divider--constrained';
|
|
29
|
+
|
|
30
|
+
const classes = [
|
|
31
|
+
baseClass,
|
|
32
|
+
orientationClass,
|
|
33
|
+
spacingClass,
|
|
34
|
+
widthClass,
|
|
35
|
+
className
|
|
36
|
+
]
|
|
37
|
+
.filter(Boolean)
|
|
38
|
+
.join(' ');
|
|
39
|
+
|
|
40
|
+
return <div className={classes} data-node-id="4042:14179" {...props} />;
|
|
41
|
+
};
|