Skip to content

Commit 1d76628

Browse files
authored
Merge pull request #870 from joe-bell/master
Add default theme key for Text
2 parents 0a33fb6 + cb80723 commit 1d76628

File tree

4 files changed

+16
-7
lines changed

4 files changed

+16
-7
lines changed

packages/components/src/Text.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ import React from 'react'
22
import Box from './Box'
33

44
export const Text = React.forwardRef((props, ref) => (
5-
<Box ref={ref} {...props} __themeKey="text" />
5+
<Box ref={ref} variant="default" {...props} __themeKey="text" />
66
))

packages/components/test/__snapshots__/index.js.snap

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -492,12 +492,6 @@ exports[`Embed renders 1`] = `
492492
`;
493493

494494
exports[`Field renders 1`] = `
495-
.emotion-2 {
496-
box-sizing: border-box;
497-
margin: 0;
498-
min-width: 0;
499-
}
500-
501495
.emotion-0 {
502496
box-sizing: border-box;
503497
margin: 0;
@@ -527,6 +521,12 @@ exports[`Field renders 1`] = `
527521
background-color: transparent;
528522
}
529523
524+
.emotion-2 {
525+
box-sizing: border-box;
526+
margin: 0;
527+
min-width: 0;
528+
}
529+
530530
<div
531531
className="emotion-2"
532532
>
@@ -1313,6 +1313,7 @@ exports[`Text renders 1`] = `
13131313
box-sizing: border-box;
13141314
margin: 0;
13151315
min-width: 0;
1316+
font-size: 20px;
13161317
}
13171318
13181319
<div

packages/components/test/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ const theme = {
6363
},
6464
},
6565
text: {
66+
default: {
67+
fontSize: 3,
68+
},
6669
heading: {
6770
fontSize: 5,
6871
},

packages/docs/src/pages/components/text.mdx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,16 @@ import { Text } from 'theme-ui'
2424
## Variants
2525

2626
Text style variants can be defined in the `theme.text` object.
27+
The Text component uses `theme.text.default` as its default variant style.
2728

2829
```js
2930
// example theme variants
3031
{
3132
text: {
33+
default: {
34+
color: 'text',
35+
fontSize: 3,
36+
},
3237
caps: {
3338
textTransform: 'uppercase',
3439
letterSpacing: '0.2em',

0 commit comments

Comments
 (0)