Skip to content

Commit d7e925a

Browse files
committed
Add variants to Theme interface
1 parent 2c72fa1 commit d7e925a

File tree

2 files changed

+123
-12
lines changed

2 files changed

+123
-12
lines changed

packages/css/src/types.ts

Lines changed: 122 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -586,11 +586,10 @@ export interface Theme {
586586
radii?: ObjectOrArray<CSS.BorderRadiusProperty<TLengthStyledSystem>>
587587
shadows?: ObjectOrArray<CSS.BoxShadowProperty>
588588
zIndices?: ObjectOrArray<CSS.ZIndexProperty>
589-
buttons?: ObjectOrArray<ThemeUICSSProperties>
590589
colorStyles?: ObjectOrArray<ThemeUICSSProperties>
591590
textStyles?: ObjectOrArray<ThemeUICSSProperties>
592-
text?: ObjectOrArray<ThemeUICSSProperties>
593591
opacities?: ObjectOrArray<CSS.OpacityProperty>
592+
594593
/**
595594
* Enable/disable custom CSS properties/variables if lower browser
596595
* support is required (for eg. IE 11).
@@ -637,4 +636,125 @@ export interface Theme {
637636
* fonts, etc.
638637
*/
639638
styles?: ThemeStyles
639+
640+
/**
641+
* Variants: partial style objects that can be used for stylistic component
642+
* variants or making part of an application themeable. These are commonly
643+
* used for typographic styles, buttons, and themeable layout components.
644+
* Variants are also used to style built-in components.
645+
*
646+
* @see https://theme-ui.com/theme-spec
647+
* @see https://theme-ui.com/components/variants
648+
*/
649+
grids?: Record<string, ThemeUIStyleObject>
650+
651+
/**
652+
* Variants: partial style objects that can be used for stylistic component
653+
* variants or making part of an application themeable. These are commonly
654+
* used for typographic styles, buttons, and themeable layout components.
655+
* Variants are also used to style built-in components.
656+
*
657+
* @see https://theme-ui.com/theme-spec
658+
* @see https://theme-ui.com/components/variants
659+
*/
660+
buttons?: Record<string, ThemeUIStyleObject>
661+
662+
/**
663+
* Variants: partial style objects that can be used for stylistic component
664+
* variants or making part of an application themeable. These are commonly
665+
* used for typographic styles, buttons, and themeable layout components.
666+
* Variants are also used to style built-in components.
667+
*
668+
* @see https://theme-ui.com/theme-spec
669+
* @see https://theme-ui.com/components/variants
670+
*/
671+
text?: Record<string, ThemeUIStyleObject>
672+
673+
/**
674+
* Variants: partial style objects that can be used for stylistic component
675+
* variants or making part of an application themeable. These are commonly
676+
* used for typographic styles, buttons, and themeable layout components.
677+
* Variants are also used to style built-in components.
678+
*
679+
* @see https://theme-ui.com/theme-spec
680+
* @see https://theme-ui.com/components/variants
681+
*/
682+
links?: Record<string, ThemeUIStyleObject>
683+
684+
/**
685+
* Variants: partial style objects that can be used for stylistic component
686+
* variants or making part of an application themeable. These are commonly
687+
* used for typographic styles, buttons, and themeable layout components.
688+
* Variants are also used to style built-in components.
689+
*
690+
* @see https://theme-ui.com/theme-spec
691+
* @see https://theme-ui.com/components/variants
692+
*/
693+
images?: Record<string, ThemeUIStyleObject>
694+
695+
/**
696+
* Variants: partial style objects that can be used for stylistic component
697+
* variants or making part of an application themeable. These are commonly
698+
* used for typographic styles, buttons, and themeable layout components.
699+
* Variants are also used to style built-in components.
700+
*
701+
* @see https://theme-ui.com/theme-spec
702+
* @see https://theme-ui.com/components/variants
703+
*/
704+
cards?: Record<string, ThemeUIStyleObject>
705+
706+
/**
707+
* Variants: partial style objects that can be used for stylistic component
708+
* variants or making part of an application themeable. These are commonly
709+
* used for typographic styles, buttons, and themeable layout components.
710+
* Variants are also used to style built-in components.
711+
*
712+
* @see https://theme-ui.com/theme-spec
713+
* @see https://theme-ui.com/components/variants
714+
*/
715+
layout?: Record<string, ThemeUIStyleObject>
716+
717+
/**
718+
* Variants: partial style objects that can be used for stylistic component
719+
* variants or making part of an application themeable. These are commonly
720+
* used for typographic styles, buttons, and themeable layout components.
721+
* Variants are also used to style built-in components.
722+
*
723+
* @see https://theme-ui.com/theme-spec
724+
* @see https://theme-ui.com/components/variants
725+
*/
726+
forms?: Record<string, ThemeUIStyleObject>
727+
728+
/**
729+
* Variants: partial style objects that can be used for stylistic component
730+
* variants or making part of an application themeable. These are commonly
731+
* used for typographic styles, buttons, and themeable layout components.
732+
* Variants are also used to style built-in components.
733+
*
734+
* @see https://theme-ui.com/theme-spec
735+
* @see https://theme-ui.com/components/variants
736+
*/
737+
badges?: Record<string, ThemeUIStyleObject>
738+
739+
/**
740+
* Variants: partial style objects that can be used for stylistic component
741+
* variants or making part of an application themeable. These are commonly
742+
* used for typographic styles, buttons, and themeable layout components.
743+
* Variants are also used to style built-in components.
744+
*
745+
* @see https://theme-ui.com/theme-spec
746+
* @see https://theme-ui.com/components/variants
747+
*/
748+
alerts?: Record<string, ThemeUIStyleObject>
749+
750+
/**
751+
* Variants: partial style objects that can be used for stylistic component
752+
* variants or making part of an application themeable. These are commonly
753+
* used for typographic styles, buttons, and themeable layout components.
754+
* Variants are also used to style built-in components.
755+
*
756+
* @see https://theme-ui.com/theme-spec
757+
* @see https://theme-ui.com/components/variants
758+
*/
759+
messages?: Record<string, ThemeUIStyleObject>
640760
}

packages/preset-sketchy/src/index.ts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,5 @@
11
import { Theme, ThemeUIStyleObject } from '@theme-ui/css'
22

3-
export interface ThemeSketchy extends Theme {
4-
cards: ThemeUIStyleObject
5-
links: ThemeUIStyleObject
6-
forms: Record<string, ThemeUIStyleObject>
7-
badges: ThemeUIStyleObject
8-
alerts: ThemeUIStyleObject
9-
messages: ThemeUIStyleObject
10-
}
11-
123
const defaultBorderStyles: ThemeUIStyleObject = {
134
border: 'thick',
145
color: 'text',
@@ -36,7 +27,7 @@ const formStyles: ThemeUIStyleObject = {
3627
},
3728
}
3829

39-
const theme: ThemeSketchy = {
30+
const theme: Theme = {
4031
colors: {
4132
text: '#000200',
4233
background: '#FAFAF9',

0 commit comments

Comments
 (0)