Skip to content

Commit f903876

Browse files
author
Joseph Lozano
committed
prototype
1 parent 64318fd commit f903876

File tree

5 files changed

+39
-4
lines changed

5 files changed

+39
-4
lines changed

packages/design-tokens/scripts/build-tokens.js

+1
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ const colorModeFormat = require('../src/formats/color-mode-attributes')
206206
`tokens/functional/components/grid/colors.json`,
207207
`tokens/functional/components/logosuite/colors.json`,
208208
`tokens/functional/components/timeline/colors.json`,
209+
`tokens/functional/components/prose/colors.js`,
209210
]
210211

211212
for (const path of filesForColorModes) {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
module.exports = {
2+
brand: {
3+
Prose: {
4+
listStyleImageUrl: {
5+
default: {
6+
value: `url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' aria-hidden='true' focusable='false' role='img' viewBox='0 -3 16 16' width='16' height='16' fill='black' style='display: inline-block; vertical-align: text-bottom; overflow: visible;'%3e%3cpath d='M2 7.75A.75.75 0 0 1 2.75 7h10a.75.75 0 0 1 0 1.5h-10A.75.75 0 0 1 2 7.75Z'%3e%3c/path%3e%3c/svg%3e ")`,
7+
dark: `url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' aria-hidden='true' focusable='false' role='img' viewBox='0 -3 16 16' width='16' height='16' fill='white' style='display: inline-block; vertical-align: text-bottom; overflow: visible;'%3e%3cpath d='M2 7.75A.75.75 0 0 1 2.75 7h10a.75.75 0 0 1 0 1.5h-10A.75.75 0 0 1 2 7.75Z'%3e%3c/path%3e%3c/svg%3e ")`,
8+
},
9+
},
10+
},
11+
},
12+
}

packages/react/src/Prose/Prose.module.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@
140140

141141
.Prose ul {
142142
list-style-type: image;
143-
list-style-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' aria-hidden='true' focusable='false' role='img' viewBox='0 -3 16 16' width='16' height='16' fill='currentColor' style='display: inline-block; vertical-align: text-bottom; overflow: visible;'%3e%3cpath d='M2 7.75A.75.75 0 0 1 2.75 7h10a.75.75 0 0 1 0 1.5h-10A.75.75 0 0 1 2 7.75Z'%3e%3c/path%3e%3c/svg%3e ");
143+
list-style-image: var(--brand-Prose-listStyleImageUrl-default);
144144
}
145145

146146
.Prose li {

packages/react/src/Prose/Prose.stories.tsx

+24-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import React from 'react'
2-
import {ComponentMeta, ComponentStory} from '@storybook/react'
2+
import {StoryFn, Meta} from '@storybook/react'
33
import {Prose} from './Prose'
44
import placeholderImage from '../fixtures/images/placeholder-600x400.png'
5+
import {ThemeProvider} from '../ThemeProvider'
56

67
export default {
78
title: 'Components/Prose',
@@ -17,7 +18,7 @@ export default {
1718
},
1819
},
1920
},
20-
} as ComponentMeta<typeof Prose>
21+
} as Meta
2122

2223
const ExampleHtmlMarkup = `
2324
<h2>Heading level 2</h2>
@@ -63,7 +64,27 @@ const ExampleHtmlMarkup = `
6364
<p>Nunc velit odio, posuere eu felis eget, consectetur fermentum nisi. Aenean tempor odio id ornare ultrices. Quisque blandit condimentum tellus, semper efficitur sapien dapibus nec. </p>
6465
`
6566

66-
export const Playground: ComponentStory<typeof Prose> = args => <Prose {...args} html={ExampleHtmlMarkup} />
67+
export const Playground: StoryFn = args => <Prose {...args} html={ExampleHtmlMarkup} />
6768

6869
export const Default = Playground.bind({})
70+
export const DarkTheme = Playground.bind({})
71+
DarkTheme.args = {
72+
darkMode: true,
73+
}
74+
DarkTheme.argTypes = {
75+
colorMode: {
76+
darkMode: 'boolean',
77+
},
78+
}
79+
DarkTheme.decorators = [
80+
(Story, {args: {darkMode}}) => (
81+
<>
82+
<div style={{backgroundColor: darkMode ? 'black' : 'white'}}>
83+
<ThemeProvider colorMode={darkMode ? 'dark' : 'light'}>
84+
<Story />
85+
</ThemeProvider>
86+
</div>
87+
</>
88+
),
89+
]
6990
Default.args = {}

packages/react/src/Prose/Prose.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import clsx from 'clsx'
33
import type {BaseProps} from '../component-helpers'
44
import styles from './Prose.module.css'
55
import '@primer/brand-primitives/lib/design-tokens/css/tokens/functional/components/prose/base.css'
6+
import '@primer/brand-primitives/lib/design-tokens/css/tokens/functional/components/prose/colors-with-modes.css'
67
import '@primer/brand-primitives/lib/design-tokens/css/tokens/functional/components/inline-link/base.css'
78

89
export type ProseProps = {

0 commit comments

Comments
 (0)