Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(themes): add dark theme presets #156

Merged
merged 36 commits into from
Dec 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
13e449f
feat(themes): add dark theme presets
simeonoff Nov 23, 2021
fdbb19d
refactor(themes): update dark palettes
simeonoff Nov 23, 2021
2674e47
Merge branch 'master' into simeonoff/dark-themes
simeonoff Nov 26, 2021
4bf7ba7
refactor(calendar-theme): improve dark theme styles.
desig9stein Nov 26, 2021
b2de9f0
feat(checkbox): implement-dark-themes
SisIvanova Nov 29, 2021
1c2e9c6
use light theme mixins
SisIvanova Nov 29, 2021
b933237
move light-checkbox mixin
SisIvanova Nov 29, 2021
4391031
dark fluent disabled styles
SisIvanova Nov 30, 2021
c9f8c42
feat(switch): implement dark themes
SisIvanova Nov 30, 2021
0639e99
feat: (list) update light and add dark themes
desig9stein Dec 1, 2021
ae8f1c0
fix: (navbar) theme colors and icon size.
desig9stein Dec 1, 2021
636db17
Merge pull request #158 from IgniteUI/sivanova/dark-checkbox
simeonoff Dec 1, 2021
b172fde
feat: (navbar) Add home icon
desig9stein Dec 1, 2021
2eb36a8
Merge remote-tracking branch 'origin/simeonoff/dark-themes' into sime…
desig9stein Dec 1, 2021
22d4c82
Merge branch 'simeonoff/dark-themes' into sivanova/dark-switch
simeonoff Dec 1, 2021
b875619
Merge pull request #165 from IgniteUI/sivanova/dark-switch
simeonoff Dec 1, 2021
ea2f45b
fix: (navbar) outline button cut off. also make sure that our atomic …
desig9stein Dec 1, 2021
29ca8e7
refactor(themes): add dark input themes
simeonoff Dec 2, 2021
dd1a628
Merge branch 'master' into simeonoff/dark-themes
simeonoff Dec 2, 2021
411bff9
lint(themes): fix errors
simeonoff Dec 2, 2021
b558411
feat(radio): implement dark themes
SisIvanova Dec 2, 2021
c1d8cdb
refactor(switch): dark themes
SisIvanova Dec 2, 2021
6a03988
fix duplicate selector
SisIvanova Dec 2, 2021
412f83b
refactor(checkbox): dark themes
SisIvanova Dec 2, 2021
643cfe4
feat(button): dark fluent theme
SisIvanova Dec 3, 2021
35dd5fe
refactor(themes): simplify structure
simeonoff Dec 3, 2021
9c3d453
Merge branch 'master' into simeonoff/dark-themes
simeonoff Dec 3, 2021
4e1c7d2
fix icon button box-shadow
SisIvanova Dec 3, 2021
2f2bb80
feat(icon-button): dark fluent theme
SisIvanova Dec 3, 2021
8d101a4
build(themes): include only light and dark folders
simeonoff Dec 3, 2021
acdf4f7
feat: (list) update themes
desig9stein Dec 3, 2021
06d4100
Merge remote-tracking branch 'origin/simeonoff/dark-themes' into sime…
desig9stein Dec 3, 2021
2b79671
fear: (scrollbars) add scrollbars styles
desig9stein Dec 3, 2021
e1db85e
Merge pull request #191 from IgniteUI/mpopov/scrollbars-final
simeonoff Dec 6, 2021
91b53ee
chore(changelog): add dark themes entry
simeonoff Dec 6, 2021
439d935
chore: Update changelog
rkaraivanov Dec 7, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 40 additions & 10 deletions .storybook/preview.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import { html } from 'lit-html';

const Themes = {
material: await import('../src/styles/themes/material.scss'),
bootstrap: await import('../src/styles/themes/bootstrap.scss'),
fluent: await import('../src/styles/themes/fluent.scss'),
indigo: await import('../src/styles/themes/indigo.scss')
}
material_light: await import('../src/styles/themes/light/material.scss'),
bootstrap_light: await import('../src/styles/themes/light/bootstrap.scss'),
fluent_light: await import('../src/styles/themes/light/fluent.scss'),
indigo_light: await import('../src/styles/themes/light/indigo.scss'),
material_dark: await import('../src/styles/themes/dark/material.scss'),
bootstrap_dark: await import('../src/styles/themes/dark/bootstrap.scss'),
fluent_dark: await import('../src/styles/themes/dark/fluent.scss'),
indigo_dark: await import('../src/styles/themes/dark/indigo.scss'),
};

export const globalTypes = {
theme: {
Expand All @@ -18,6 +22,16 @@ export const globalTypes = {
showName: 'True',
},
},
variant: {
name: 'Variant',
description: 'Theme variant',
defaultValue: 'light',
toolbar: {
icon: 'mirror',
items: ['light', 'dark'],
showName: 'True',
},
},
direction: {
name: 'Direction',
description: 'Component direction',
Expand All @@ -26,16 +40,32 @@ export const globalTypes = {
icon: 'accessibility',
items: ['ltr', 'rtl'],
showName: 'True',
}
}
},
},
};

export const parameters = {
backgrounds: {
default: 'light',
values: [
{
name: 'light',
value: '#fff',
},
{
name: 'dark',
value: '#000',
},
],
},
};

const getTheme = (themeName) => {
return Themes[themeName];
const getTheme = (themeName, variant) => {
return Themes[`${themeName}_${variant}`];
};

const themeProvider = (Story, context) => {
const theme = getTheme(context.globals.theme);
const theme = getTheme(context.globals.theme, context.globals.variant);

// Workaround for https://github.com/cfware/babel-plugin-template-html-minifier/issues/56
const htmlNoMin = html;
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]

### Added
- Dark Themes

## 1.0.0 - 2021-11-22
Initial release of Ignite UI Web Components

Expand Down
2 changes: 1 addition & 1 deletion scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const DEST_DIR = path.join.bind(null, path.resolve(__dirname, '../dist'));
const THEMES_PATH = `src/styles/themes`;

async function buildThemes() {
const paths = await globby(`${THEMES_PATH}/**/*.scss`);
const paths = await globby(`${THEMES_PATH}/{light,dark}/*.scss`);

for (const sassFile of paths) {
const result = await renderSass({
Expand Down
14 changes: 9 additions & 5 deletions src/components/button/button.fluent.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
@use '../../styles/utilities' as utils;

$button-color: #{utils.contrast-color(primary, 600)} !default;
$hover-color: #{utils.color(primary, 600)} !default;
$active-color: #{utils.color(primary, 700)} !default;

@mixin theme() {
igc-button[variant='contained']::part(base),
igc-button[variant='fab']::part(base) {
Expand Down Expand Up @@ -129,21 +133,21 @@
// FAB & CONTAINED
igc-button[variant='contained']:not([disabled])::part(base),
igc-button[variant='fab']:not([disabled])::part(base) {
color: #{utils.contrast-color(primary, 600)};
color: $button-color;

&:hover,
&:focus-visible:hover {
color: #{utils.contrast-color(primary, 600)};
color: $button-color;

&::before {
opacity: 1;
background: #{utils.color(primary, 600)};
background: $hover-color;
}
}

&:focus,
&:active {
color: #{utils.contrast-color(primary, 600)};
color: $button-color;
}

&::before {
Expand All @@ -155,7 +159,7 @@
&:focus-visible:active {
&::before {
opacity: 1;
background: #{utils.color(primary, 700)};
background: $active-color;
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/components/button/icon-button.bootstrap.scss
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
&:focus,
&:active {
background: #{utils.color(primary, 600)};
box-shadow: 0 0 0 utils.rem(3px) utils.color(primary, 200);
box-shadow: 0 0 0 utils.rem(4px) utils.color(primary, 200, .5);
}
}

Expand All @@ -48,7 +48,7 @@
&:active {
color: #{utils.contrast-color(primary, 600)};
background: #{utils.color(primary, 600)};
box-shadow: 0 0 0 utils.rem(3px) utils.color(primary, 200);
box-shadow: 0 0 0 utils.rem(4px) utils.color(primary, 200, .5);
}
}

Expand Down
7 changes: 5 additions & 2 deletions src/components/button/icon-button.fluent.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
@use '../../styles/utilities' as utils;

$button-color: #{utils.contrast-color(primary, 600)} !default;
$hover-color: #{utils.color(primary, 600)} !default;

@mixin theme() {
igc-icon-button::part(base) {
background: transparent;
Expand Down Expand Up @@ -35,11 +38,11 @@
}

igc-icon-button[variant='contained']:not([disabled])::part(base) {
color: utils.contrast-color(primary, 600);
color: $button-color;
background: utils.color(primary, 500);

&:hover {
background: utils.color(primary, 600);
background: $hover-color;
}

&:focus-visible::after {
Expand Down
3 changes: 1 addition & 2 deletions src/components/calendar/calendar.bootstrap.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ $current-color: color(gray, 800);
$range-preview-background: color(primary, 200);
$range-preview-color: contrast-color(primary, 600);
$header-background: color(secondary, 50, .2);
$header-color: contrast-color(secondary, 50);
$header-color: contrast-color(gray, 50);
$header-border-width: rem(1px);
$border-color: color(gray, 300);
$date-color: color(gray, 700);
Expand All @@ -22,7 +22,6 @@ $days-view-gap: rem(4px);
igc-calendar {
border: rem(1px) solid $border-color;
border-radius: $border-radius;
background: transparent;
}

igc-calendar::part(days-row) {
Expand Down
1 change: 1 addition & 0 deletions src/components/calendar/calendar.material.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
flex-direction: column;
font-family: var(--igc-font-family);
background: $calendar-background;
color: $calendar-foreground;

> * {
font-family: var(--igc-font-family);
Expand Down
18 changes: 18 additions & 0 deletions src/components/calendar/days-view/days-view.material.scss
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ $border-radius: rem(4px);
&:hover,
&:focus {
background: color(secondary, 100);
color: contrast-color(secondary, 100);
border-color: color(secondary, 100);
}
}
Expand All @@ -43,6 +44,11 @@ $border-radius: rem(4px);

[part~='current'][part~='date-inner'] {
box-shadow: inset 0 0 0 rem(1px) color(gray, 600);

&:hover,
&:focus {
box-shadow: inset 0 0 0 rem(1px) color(surface);
}
}

[part~='date'],
Expand Down Expand Up @@ -145,6 +151,14 @@ $border-radius: rem(4px);
color: $week-number-color;
}

[part~='date-inner'][part~='weekend'],
[part~='date-inner'][part~='inactive'] {
&:hover,
&:focus {
color: contrast-color(secondary, 100);
}
}

[part~='date-inner'][part~='selected'][part~='range'][part~='first'],
[part~='date-inner'][part~='selected'][part~='range'][part~='last'],
[part~='date-inner'][part~='selected'][part~='range'][part~='weekend'][part~='first'],
Expand Down Expand Up @@ -196,6 +210,10 @@ $border-radius: rem(4px);
[part='week-number-inner first'] {
border-top-left-radius: $border-radius;
border-top-right-radius: $border-radius;

&::after {
display: none;
}
}

[part='week-number-inner last'] {
Expand Down
1 change: 1 addition & 0 deletions src/components/calendar/shared-calendar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ $date-size-large: rem(32px);
$date-size-medium: rem(28px);
$date-size-small: rem(24px);
$calendar-background: color(surface);
$calendar-foreground: contrast-color(surface);
2 changes: 1 addition & 1 deletion src/components/card/card.bootstrap.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

@mixin theme() {
igc-card {
background: white;
background: #{utils.color(surface, 500)};
border-radius: #{utils.rem(4px)};
}

Expand Down
1 change: 1 addition & 0 deletions src/components/checkbox/checkbox.bootstrap.scss
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
stroke-width: 4;
transform: scale(.7);
transition: none;
stroke: white;
}

igc-checkbox::part(label) {
Expand Down
Loading