Skip to content

Commit

Permalink
feat: Add V9 Theme (#1344) (#1347)
Browse files Browse the repository at this point in the history
* feat: Add V9 Theme



* update changelog



* update colors and typography



---------


(cherry picked from commit a45811b)

Signed-off-by: Viraj Sanghvi <virajs@amazon.com>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
1 parent 70d4cdb commit 80ffcf3
Show file tree
Hide file tree
Showing 65 changed files with 3,708 additions and 7 deletions.
4 changes: 4 additions & 0 deletions src-docs/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ import themeLight from './theme_light.scss';
import themeDark from './theme_dark.scss';
import themeNextLight from './theme_next_light.scss';
import themeNextDark from './theme_next_dark.scss';
import themeV9Light from './theme_v9_light.scss';
import themeV9Dark from './theme_v9_dark.scss';
import { ThemeProvider } from './components/with_theme/theme_context';
import ScrollToHash from './components/scroll_to_hash';
import { LinkWrapper } from './views/link_wrapper';
Expand All @@ -34,6 +36,8 @@ registerTheme('light', [themeLight]);
registerTheme('dark', [themeDark]);
registerTheme('next-light', [themeNextLight]);
registerTheme('next-dark', [themeNextDark]);
registerTheme('v9-light', [themeV9Light]);
registerTheme('v9-dark', [themeV9Dark]);

// Set up app

Expand Down
21 changes: 21 additions & 0 deletions src-docs/src/theme_v9_dark.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*!
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*
* Modifications Copyright OpenSearch Contributors. See
* GitHub history for details.
*/

// sass-lint:disable no-url-domains, no-url-protocols
@import url('https://fonts.googleapis.com/css2?family=Fira+Code:wght@300..700&family=Rubik:ital,wght@0,300..900;1,300..900&display=swap');

@import '../../src/theme_v9_dark';
@import './components/guide_components';
@import './services/playground/index';
@import './views/suggest/global_filter_group';

// Elastic charts
@import '../../src/themes/charts/theme';
21 changes: 21 additions & 0 deletions src-docs/src/theme_v9_light.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*!
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*
* Modifications Copyright OpenSearch Contributors. See
* GitHub history for details.
*/

// sass-lint:disable no-url-domains, no-url-protocols
@import url('https://fonts.googleapis.com/css2?family=Fira+Code:wght@300..700&family=Rubik:ital,wght@0,300..900;1,300..900&display=swap');

@import '../../src/theme_v9_light';
@import './components/guide_components';
@import './services/playground/index';
@import './views/suggest/global_filter_group';

// Elastic charts
@import '../../src/themes/charts/theme';
2 changes: 1 addition & 1 deletion src/components/button/_button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
@include ouiButton;
@include ouiSlightShadow;

border-radius: $ouiBorderRadius;
border-radius: $ouiButtonBorderRadius;
min-width: $ouiButtonMinWidth;

.ouiButton__content {
Expand Down
2 changes: 1 addition & 1 deletion src/components/button/button_group/_button_group.scss
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

.ouiButtonGroup__buttons {
@include ouiSlightShadow;
border-radius: $ouiBorderRadius + 1px; // Simply for the box-shadow
border-radius: $ouiButtonBorderRadius + 1px; // Simply for the box-shadow
max-width: 100%;
display: flex;
overflow: hidden;
Expand Down
6 changes: 3 additions & 3 deletions src/components/button/button_group/_button_group_button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,11 @@
}

&:first-child {
border-radius: $ouiBorderRadius 0 0 $ouiBorderRadius;
border-radius: $ouiButtonBorderRadius 0 0 $ouiButtonBorderRadius;
}

&:last-child {
border-radius: 0 $ouiBorderRadius $ouiBorderRadius 0;
border-radius: 0 $ouiButtonBorderRadius $ouiButtonBorderRadius 0;
}
}

Expand Down Expand Up @@ -174,7 +174,7 @@
height: $ouiFormControlCompressedHeight - 2px;
line-height: $ouiFormControlCompressedHeight - 2px; // prevents descenders from getting cut off
font-size: $ouiFontSizeS;
border-radius: $ouiBorderRadius;
border-radius: $ouiButtonBorderRadius;
// Offset the background color from the border by 2px
// by clipping background to before the padding starts
padding: 2px;
Expand Down
2 changes: 1 addition & 1 deletion src/components/button/button_icon/_button_icon.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
@include ouiButton;
@include ouiSlightShadow;

border-radius: $ouiBorderRadius;
border-radius: $ouiButtonBorderRadius;
width: $ouiButtonHeight;

// Ensures center alignment of any sized icon inside buttons and anchors
Expand Down
2 changes: 1 addition & 1 deletion src/components/split_button/_split_button_control.scss
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ $splitButtonSeparatorColor: shade($ouiColorPrimary, 50%);

.ouiSplitButtonControl {
border: $ouiBorderWidthThick solid $ouiBorderColor;
border-radius: $ouiBorderRadius;
border-radius: $ouiButtonBorderRadius;
}

// Create button modifiers based upon the map.
Expand Down
3 changes: 3 additions & 0 deletions src/global_styling/variables/_buttons.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ $ouiButtonColorDisabled: tintOrShade($ouiTextColor, 70%, 70%) !default;
$ouiButtonColorDisabledText: makeDisabledContrastColor($ouiButtonColorDisabled) !default;
$ouiButtonColorGhostDisabled: lightOrDarkTheme($ouiColorDarkShade, $ouiColorLightShade) !default;

$ouiButtonBorderRadius: $ouiBorderRadius !default;

// Modifier naming and colors.
$ouiButtonTypes: (
primary: $ouiColorPrimary,
Expand All @@ -39,5 +41,6 @@ $euiButtonHeightXSmall: $ouiButtonHeightXSmall;
$euiButtonColorDisabled: $ouiButtonColorDisabled;
$euiButtonColorDisabledText: $ouiButtonColorDisabledText;
$euiButtonColorGhostDisabled: $ouiButtonColorGhostDisabled;
$euiButtonBorderRadius: $ouiButtonBorderRadius;
$euiButtonTypes: $ouiButtonTypes;
/* End of Aliases */
22 changes: 22 additions & 0 deletions src/theme_v9_dark.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*!
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*
* Modifications Copyright OpenSearch Contributors. See
* GitHub history for details.
*/

// These are variable overwrites used only for this theme.
@import 'themes/v9/v9_colors_dark';

// Global styling
@import 'themes/v9/global_styling/index';

// Components
@import 'components/index';

// Packages
@import '../packages/index';
22 changes: 22 additions & 0 deletions src/theme_v9_light.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*!
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*
* Modifications Copyright OpenSearch Contributors. See
* GitHub history for details.
*/

// This is the default theme.
@import 'themes/v9/v9_colors_light';

// Global styling
@import 'themes/v9/global_styling/index';

// Components
@import 'components/index';

// Packages
@import '../packages/index';
41 changes: 41 additions & 0 deletions src/themes/charts/themes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,29 @@ import {
const ouiNextFontFamily =
"'Source Sans 3', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'";

// @ts-ignore typescript doesn't understand the babel preprocessor
import {
ouiColorChartBand as ouiV9ColorChartBand,
ouiColorChartLines as ouiV9ColorChartLines,
ouiColorDarkShade as ouiV9ColorDarkShade,
ouiColorDarkestShade as ouiV9ColorDarkestShade,
ouiColorEmptyShade as ouiV9ColorEmptyShade,
// @ts-ignore typescript doesn't understand the babel preprocessor
} from '!!variables-from-scss!!../v9/global_styling/variables/_colors.scss';

// @ts-ignore typescript doesn't understand the babel preprocessor
import {
ouiColorChartBand as ouiV9ColorChartBandDark,
ouiColorChartLines as ouiV9ColorChartLinesDark,
ouiColorDarkShade as ouiV9ColorDarkShadeDark,
ouiColorDarkestShade as ouiV9ColorDarkestShadeDark,
ouiColorEmptyShade as ouiV9ColorEmptyShadeDark,
// @ts-ignore typescript doesn't understand the babel preprocessor
} from '!!variables-from-scss!!../v9/v9_colors_dark.scss';

const ouiV9FontFamily =
"'Rubik', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'";

export interface OuiChartThemeType {
lineAnnotation: LineAnnotationStyle;
theme: PartialTheme;
Expand Down Expand Up @@ -269,6 +292,22 @@ export const OUI_CHARTS_NEXT_THEME_DARK: OuiChartThemeType = createTheme({
ouiColorEmptyShade: ouiNextColorEmptyShadeDark,
ouiFontFamily: ouiNextFontFamily,
});
export const OUI_CHARTS_V9_THEME_LIGHT: OuiChartThemeType = createTheme({
ouiColorChartBand: ouiV9ColorChartBand,
ouiColorChartLines: ouiV9ColorChartLines,
ouiColorDarkShade: ouiV9ColorDarkShade,
ouiColorDarkestShade: ouiV9ColorDarkestShade,
ouiColorEmptyShade: ouiV9ColorEmptyShade,
ouiFontFamily: ouiV9FontFamily,
});
export const OUI_CHARTS_V9_THEME_DARK: OuiChartThemeType = createTheme({
ouiColorChartBand: ouiV9ColorChartBandDark,
ouiColorChartLines: ouiV9ColorChartLinesDark,
ouiColorDarkShade: ouiV9ColorDarkShadeDark,
ouiColorDarkestShade: ouiV9ColorDarkestShadeDark,
ouiColorEmptyShade: ouiV9ColorEmptyShadeDark,
ouiFontFamily: ouiV9FontFamily,
});

export const OUI_SPARKLINE_THEME_PARTIAL: PartialTheme = {
lineSeriesStyle: {
Expand All @@ -293,5 +332,7 @@ export const EUI_CHARTS_THEME_LIGHT = OUI_CHARTS_THEME_LIGHT;
export const EUI_CHARTS_THEME_DARK = OUI_CHARTS_THEME_DARK;
export const EUI_CHARTS_NEXT_THEME_LIGHT = OUI_CHARTS_NEXT_THEME_LIGHT;
export const EUI_CHARTS_NEXT_THEME_DARK = OUI_CHARTS_NEXT_THEME_DARK;
export const EUI_CHARTS_V9_THEME_LIGHT = OUI_CHARTS_V9_THEME_LIGHT;
export const EUI_CHARTS_V9_THEME_DARK = OUI_CHARTS_V9_THEME_DARK;
export const EUI_SPARKLINE_THEME_PARTIAL = OUI_SPARKLINE_THEME_PARTIAL;
/* End of Aliases */
3 changes: 3 additions & 0 deletions src/themes/oui-next/global_styling/variables/_buttons.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ $ouiButtonColorDisabled: tintOrShade($ouiTextColor, 70%, 70%) !default;
$ouiButtonColorDisabledText: makeDisabledContrastColor($ouiButtonColorDisabled) !default;
$ouiButtonColorGhostDisabled: lightOrDarkTheme($ouiColorDarkShade, $ouiColorLightShade) !default;

$ouiButtonBorderRadius: $ouiBorderRadius !default;

// Modifier naming and colors.
$ouiButtonTypes: (
primary: $ouiColorPrimary,
Expand All @@ -39,5 +41,6 @@ $euiButtonHeightXSmall: $ouiButtonHeightXSmall;
$euiButtonColorDisabled: $ouiButtonColorDisabled;
$euiButtonColorDisabledText: $ouiButtonColorDisabledText;
$euiButtonColorGhostDisabled: $ouiButtonColorGhostDisabled;
$euiButtonBorderRadius: $ouiButtonBorderRadius;
$euiButtonTypes: $ouiButtonTypes;
/* End of Aliases */
8 changes: 8 additions & 0 deletions src/themes/themes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,14 @@ export const OUI_THEMES: OUI_THEME[] = [
text: 'Next Dark',
value: 'next-dark',
},
{
text: 'v9 Light',
value: 'v9-light',
},
{
text: 'v9 Dark',
value: 'v9-dark',
},
];

/* OUI -> EUI Aliases */
Expand Down
9 changes: 9 additions & 0 deletions src/themes/v9/global_styling/css_variables/_fonts.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*!
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

:root {
--oui-font-family: #{$ouiFontFamily};
--oui-code-font-family: #{$ouiCodeFontFamily};
}
6 changes: 6 additions & 0 deletions src/themes/v9/global_styling/css_variables/_index.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/*!
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

@import 'fonts';
Loading

0 comments on commit 80ffcf3

Please sign in to comment.