Skip to content

Commit e0f9876

Browse files
authored
[Theming] More color options and better docs (#5939)
* Slight adjustment to `lightestShade` and `body` colors * Added `method: transparent` option to `useEuiBackgroundColor` * Setup for base button colors * [Colors] Using tabbed docs page and creating Functions tab * Moved contrast utilities section and simplified * Moved transparency to theme and simplified * Moved shade/tint functions * Moved isDark to theme * Moved Sizing to a tabbed page * Update contrast sections * Moved text utilities to `Theming / Typography` now with tabs * Moved `Utilities / Responsive` to `Theme / Breakpoints/ Utilities` * Passing `euiTheme.breakpoint` to `getBreakpoint()`
1 parent e5ad86a commit e0f9876

File tree

92 files changed

+2009
-2050
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+2009
-2050
lines changed

src-docs/src/components/guide_page/_guide_page.scss

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,11 @@ $guideSideNavWidth: 240px;
6464
}
6565

6666
.euiSideNavItem--trunk > .euiSideNavItemButton .guideSideNav__item--inSearch .euiMark {
67-
color: $euiColorPrimary;
67+
color: $euiColorPrimaryText;
68+
}
69+
70+
.guideSideNav__item--openSubTitle {
71+
color: $euiTitleColor;
6872
}
6973

7074

src-docs/src/components/guide_page/guide_page_chrome.js

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,18 @@ export class GuidePageChrome extends Component {
101101
return subSectionsWithTitles.map(({ title, sections }) => {
102102
const id = slugify(title);
103103

104+
const subSectionHref = `${href}/${id}`;
105+
const subSectionHashIdHref = `${href}#${id}`;
106+
107+
const sectionHref = sections ? subSectionHref : subSectionHashIdHref;
108+
const subItems = sections
109+
? this.renderSubSections(sectionHref, sections, searchTerm)
110+
: undefined;
111+
112+
const isCurrentlyOpenSubSection = window.location.hash.includes(
113+
subSectionHref
114+
);
115+
104116
let name = title;
105117
if (searchTerm) {
106118
name = (
@@ -113,21 +125,15 @@ export class GuidePageChrome extends Component {
113125
);
114126
}
115127

116-
const subSectionHref = `${href}/${id}`;
117-
const subSectionHashIdHref = `${href}#${id}`;
118-
119-
const sectionHref = sections ? subSectionHref : subSectionHashIdHref;
120-
const subItems = sections
121-
? this.renderSubSections(sectionHref, sections, searchTerm)
122-
: undefined;
123-
124128
return {
125129
id: sectionHref,
126-
name,
130+
name: isCurrentlyOpenSubSection ? <strong>{name}</strong> : name,
127131
href: sectionHref,
132+
className: isCurrentlyOpenSubSection
133+
? 'guideSideNav__item--openSubTitle'
134+
: '',
128135
items: subItems,
129-
isSelected: window.location.hash.includes(subSectionHref),
130-
forceOpen: !!searchTerm,
136+
forceOpen: !!searchTerm || isCurrentlyOpenSubSection,
131137
};
132138
});
133139
};

src-docs/src/components/guide_tabbed_page/guide_tabbed_page.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,13 @@ const GuideTabbedPageComponent: FunctionComponent<GuideTabbedPageProps> = ({
4949
const currentLanguage = themeContext.themeLanguage;
5050
const showSass = currentLanguage.includes('sass');
5151

52-
const betaBadge = isBeta && (
53-
<EuiBetaBadge
54-
label="Beta"
55-
tooltipContent="This component is still under development and may contain breaking changes in the nearby future."
56-
/>
57-
);
52+
const betaBadge =
53+
isBeta || (showThemeLanguageToggle && !showSass) ? (
54+
<EuiBetaBadge
55+
label="Beta"
56+
tooltipContent="This component is still under development and may contain breaking changes in the nearby future."
57+
/>
58+
) : undefined;
5859

5960
let tabs:
6061
| Array<{

src-docs/src/components/with_theme/language_selector.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const NOTIF_STORAGE_VALUE = 'dismissed';
1919

2020
export const LanguageSelector = ({
2121
onChange,
22-
showTour = true,
22+
showTour = false,
2323
}: {
2424
onChange?: (id: string) => void;
2525
showTour?: boolean;

src-docs/src/routes.js

Lines changed: 69 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ import { SitewideSearchExample } from './views/selectable/selectable_sitewide_te
3636

3737
import { ColorPaletteExample } from './views/color_palette/color_palette_example';
3838

39-
import { ColorExample } from './views/color/color_example';
40-
4139
import { PrettyDurationExample } from './views/pretty_duration/pretty_duration_example';
4240

4341
import { UtilityClassesExample } from './views/utility_classes/utility_classes_example';
@@ -191,7 +189,6 @@ import { ResizeObserverExample } from './views/resize_observer/resize_observer_e
191189

192190
import { ResizableContainerExample } from './views/resizable_container/resizable_container_example';
193191

194-
import { ResponsiveExample } from './views/responsive/responsive_example';
195192
import { ScrollExample } from './views/scroll/scroll_example';
196193

197194
import { SearchBarExample } from './views/search_bar/search_bar_example';
@@ -220,8 +217,6 @@ import { TextDiffExample } from './views/text_diff/text_diff_example';
220217

221218
import { TextExample } from './views/text/text_example';
222219

223-
import { TextUtilitiesExample } from './views/text_utilities/text_utilities_example';
224-
225220
import { TimelineExample } from './views/timeline/timeline_example';
226221

227222
import { TitleExample } from './views/title/title_example';
@@ -242,13 +237,27 @@ import { SuperSelectExample } from './views/super_select/super_select_example';
242237

243238
import { ThemeExample } from './views/theme/theme_example';
244239
import { ColorModeExample } from './views/theme/color_mode/color_mode_example';
245-
import Breakpoints from './views/theme/breakpoints/breakpoints';
240+
import { BreakpointsExample } from './views/theme/breakpoints/breakpoints_example';
246241
import Borders, { bordersSections } from './views/theme/borders/borders';
247-
import Color, { colorsSections } from './views/theme/color/colors';
248-
import Sizing, { sizingSections } from './views/theme/sizing/sizing';
242+
import Color, { colorsInfo, colorsSections } from './views/theme/color/tokens';
243+
import ColorContrast, { contrastSections } from './views/theme/color/contrast';
244+
import ColorFunctions, {
245+
colorsFunctionsSections,
246+
} from './views/theme/color/functions';
247+
import Sizing, {
248+
sizingInfo,
249+
sizingSections,
250+
} from './views/theme/sizing/tokens';
251+
import SizingFunctions, {
252+
sizingFunctionSections,
253+
} from './views/theme/sizing/functions';
249254
import Typography, {
255+
typographyInfo,
250256
typographySections,
251-
} from './views/theme/typography/typography';
257+
} from './views/theme/typography/values';
258+
import TextUtilities, {
259+
textUtilitiesSections,
260+
} from './views/theme/typography/utilities';
252261
import Other, { otherSections } from './views/theme/other/other';
253262
import ThemeValues from './views/theme/customizing/values';
254263

@@ -398,30 +407,62 @@ const navigation = [
398407
items: [
399408
createExample(ThemeExample, 'Theme provider'),
400409
createExample(ColorModeExample),
401-
{
402-
name: 'Breakpoints',
403-
component: Breakpoints,
404-
},
410+
createTabbedPage(BreakpointsExample),
405411
{
406412
name: 'Borders',
407413
component: Borders,
408414
sections: bordersSections,
409415
},
410-
{
411-
name: 'Colors',
412-
component: Color,
413-
sections: colorsSections,
414-
},
415-
{
416-
name: 'Sizing',
417-
component: Sizing,
418-
sections: sizingSections,
419-
},
420-
{
421-
name: 'Typography',
422-
component: Typography,
423-
sections: typographySections,
424-
},
416+
createTabbedPage({
417+
...colorsInfo,
418+
pages: [
419+
{
420+
title: 'Values',
421+
page: Color,
422+
sections: colorsSections,
423+
},
424+
{
425+
title: 'Utilities',
426+
page: ColorFunctions,
427+
sections: colorsFunctionsSections,
428+
},
429+
{
430+
title: 'Contrast',
431+
page: ColorContrast,
432+
sections: contrastSections,
433+
},
434+
],
435+
}),
436+
createTabbedPage({
437+
...sizingInfo,
438+
pages: [
439+
{
440+
title: 'Values',
441+
page: Sizing,
442+
sections: sizingSections,
443+
},
444+
{
445+
title: 'Utilities',
446+
page: SizingFunctions,
447+
sections: sizingFunctionSections,
448+
},
449+
],
450+
}),
451+
createTabbedPage({
452+
...typographyInfo,
453+
pages: [
454+
{
455+
title: 'Values',
456+
page: Typography,
457+
sections: typographySections,
458+
},
459+
{
460+
title: 'Utilities',
461+
page: TextUtilities,
462+
sections: textUtilitiesSections,
463+
},
464+
],
465+
}),
425466
{
426467
name: 'More tokens',
427468
component: Other,
@@ -564,7 +605,6 @@ const navigation = [
564605
AccessibilityExample,
565606
AutoSizerExample,
566607
BeaconExample,
567-
ColorExample,
568608
ColorPaletteExample,
569609
CopyExample,
570610
UtilityClassesExample,
@@ -582,10 +622,8 @@ const navigation = [
582622
PrettyDurationExample,
583623
ProviderExample,
584624
ResizeObserverExample,
585-
ResponsiveExample,
586625
ScrollExample,
587626
TextDiffExample,
588-
TextUtilitiesExample,
589627
WindowEventExample,
590628
].map((example) => createExample(example)),
591629
},

src-docs/src/views/color/color_example.js

Lines changed: 0 additions & 37 deletions
This file was deleted.

src-docs/src/views/color/contrast/contrast.tsx

Lines changed: 0 additions & 52 deletions
This file was deleted.

src-docs/src/views/color/contrast/contrast_body.tsx

Lines changed: 0 additions & 50 deletions
This file was deleted.

0 commit comments

Comments
 (0)