Skip to content

Commit 28b38af

Browse files
Add missing color properties and documentation to storybook (#242)
* added missing properties to the list and added docs * Revert "added missing properties to the list and added docs" This reverts commit ecbe1a8. * added missing properties to the list and added docs * minor story adjustments * text correction using default variant description * default color not primary * specify filtering Co-authored-by: Niels Lyngsø <[email protected]>
1 parent d29c6c5 commit 28b38af

File tree

1 file changed

+108
-12
lines changed

1 file changed

+108
-12
lines changed

packages/uui-css/lib/custom-properties.story.ts

Lines changed: 108 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -86,27 +86,123 @@ const propertySizeTemplate = (property: any) => html` <uui-table-row>
8686
</uui-table-row>`;
8787

8888
export const InterfaceColors = () => {
89-
const surface = ['surface', 'background', 'text', 'color-border', 'divider'];
90-
const state = ['selected', 'current', 'disabled'];
91-
const color = ['primary', 'positive', 'warning', 'danger', 'disabled'];
92-
const universal = ['header', 'focus', 'hover'];
89+
const base = [
90+
'--uui-color-surface',
91+
'--uui-color-background',
92+
'--uui-color-text',
93+
'--uui-color-color-border',
94+
'--uui-color-divider',
95+
'--uui-color-interactive',
96+
];
97+
const state = [
98+
'--uui-color-selected',
99+
'--uui-color-current',
100+
'--uui-color-disabled',
101+
'--uui-color-focus',
102+
];
103+
const color = [
104+
'--uui-color-default',
105+
'--uui-color-positive',
106+
'--uui-color-warning',
107+
'--uui-color-danger',
108+
'--uui-color-disabled',
109+
];
110+
const universal = ['--uui-color-header'];
93111

94112
return html`
95-
<h2>Interface Colors</h2>
96-
<p>
97-
These are used to overwrite selected interface properties to get a
98-
specific look.
99-
</p>
100-
101-
<h3>Surface</h3>
113+
<article style="max-width:580px;">
114+
<div
115+
style="display:block; border-bottom: 1px solid var(--uui-palette-cocoa-black); padding-top: var(--uui-size-layout-5); margin-bottom:var(--uui-size-layout-3); padding-bottom:var(--uui-size-layout-1);">
116+
<h1>Interface Colors</h1>
117+
<p class="uui-lead">
118+
Interface styling should use the following properties to ensure
119+
contrasts and appearance follows the current theme.
120+
</p>
121+
<p>
122+
Here's a description and examples of how to use the interface colors.
123+
</p>
124+
</div>
125+
126+
<h4>Text and interactables</h4>
127+
<ul>
128+
<li>
129+
<b>Text</b> - Use it for text, icons or other elements that needs to
130+
standout from the base of the element
131+
</li>
132+
<li>
133+
<b>Interactable</b> - Used when the text or icon is interactable, such
134+
as a link
135+
</li>
136+
</ul>
137+
138+
<h4>States</h4>
139+
<ul>
140+
<li>
141+
<b>Selected</b> - Use to highlight text or background when a component
142+
is in the 'selected' state.
143+
</li>
144+
<li>
145+
<b>Current</b> - Use to highlight text or background when a component
146+
is in the 'current' state, only used by navigation items to indicate
147+
the current location.
148+
</li>
149+
<li><b>Disabled</b> - Use for displaying disabled state.</li>
150+
</ul>
151+
152+
<h4>Borders and dividers</h4>
153+
<ul>
154+
<li><b>Border</b> - Use for component borders</li>
155+
<li>
156+
<b>Divider</b> - Used for thin border that provides a visual
157+
separation. Example: a list of items
158+
</li>
159+
</ul>
160+
161+
<h4>Misc</h4>
162+
<ul>
163+
<li><b>Surface</b> - The general background color for elements</li>
164+
<li><b>Background</b> - The general background color of the app</li>
165+
<li><b>Header</b> - Background color of the header of the app</li>
166+
<li>
167+
<b>Focus</b> - Color for the focus outline on inputs, buttons, links
168+
and so on
169+
</li>
170+
</ul>
171+
172+
<h4>Color variants</h4>
173+
<p>
174+
Each color can come in additional variants. What below is refereed to as
175+
the default variant, meaning no variant-name is prepended to the
176+
variable-name:
177+
</p>
178+
<ul>
179+
<li>
180+
<b>Contrast</b> - This color will stand out and be readable with the
181+
default variant as it's background. Mostly used for text and icons.
182+
</li>
183+
<li>
184+
<b>Standalone</b> - This color will have a higher contrast to the
185+
background than it's default variant. Example: if the background is
186+
light, the standalone variant will be a darker variant of the default
187+
variant. Often used when thin or smaller items has to stand out on the
188+
background. Useful for items such as: text, icons and border.
189+
</li>
190+
<li>
191+
<b>Emphasis</b> - Used when you want to emphasize an element, make it
192+
stand out. Mostly used for hover and focus states.
193+
</li>
194+
</ul>
195+
</article>
196+
197+
<h3>Base</h3>
102198
<uui-table @click=${copyToClipboard}>
103199
<uui-table-head>
104200
<uui-table-head-cell>Custom property name</uui-table-head-cell>
105201
<uui-table-head-cell>Value</uui-table-head-cell>
106202
<uui-table-head-cell>Example</uui-table-head-cell>
107203
</uui-table-head>
108204
${properties
109-
.filter(property => surface.some(x => property.key.includes(x)))
205+
.filter(property => base.some(x => property.key.includes(x)))
110206
.map(property => propertyColorTemplate(property))}
111207
</uui-table>
112208

0 commit comments

Comments
 (0)