-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: gen colors & replace color-mods * fix(popover): set text color * chore: storybook dark styles * chore: build only needed colors * chore: fix mode-switcher * chore: add missing colors * chore: mode-switcher refactoring * chore: theme-switcher refactoring * chore: fix mode + theme * feat: replace color-mods in themes * chore: fix screenshot-testing * chore: update screenshots * chore: tag story filename case issue * fix(amount-input): caret color * chore: fix screenshots
- Loading branch information
Showing
84 changed files
with
983 additions
and
483 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
body { | ||
background: var(--color-dark-bg-primary); | ||
color: var(--color-dark-text-primary); | ||
} | ||
|
||
#docs-root .sbdocs-wrapper { | ||
background: var(--color-dark-bg-primary); | ||
color: var(--color-dark-text-primary); | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { extractMixinContent, getOrCreateStyleTag } from '../utils'; | ||
|
||
import indigoDark from '!!raw-loader!../../../packages/themes/src/mixins/colors/colors-indigo.css'; | ||
import bluetintDark from '!!raw-loader!../../../packages/themes/src/mixins/colors/colors-bluetint.css'; | ||
import darkStyles from '!!raw-loader!./dark.css'; | ||
|
||
export const MODES = ['light', 'dark']; | ||
export const MODE_COLORS_TAG_ID = 'mode-colors'; | ||
|
||
export const darkColorsMap = { | ||
indigo: extractMixinContent(indigoDark), | ||
bluetint: extractMixinContent(bluetintDark), | ||
}; | ||
|
||
export function setModeVars(mode) { | ||
const vars = mode === 'dark' ? `:root { ${darkColorsMap['indigo']} }\n${darkStyles}` : ''; | ||
|
||
getOrCreateStyleTag(MODE_COLORS_TAG_ID).innerHTML = vars; | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
@import '../../../../packages/themes/src/mixins/click.css'; | ||
|
||
:root { | ||
@mixin theme-click; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
@import '../../../../packages/themes/src/mixins/corp.css'; | ||
|
||
:root { | ||
@mixin theme-corp; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
@import '../../../../packages/themes/src/mixins/mobile.css'; | ||
|
||
:root { | ||
@mixin theme-mobile; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
@import '../../../../packages/themes/src/mixins/site.css'; | ||
|
||
:root { | ||
@mixin theme-site; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { getOrCreateStyleTag } from '../utils'; | ||
import { MODE_COLORS_TAG_ID } from '../mode-switcher/utils'; | ||
|
||
import bluetintColors from '!!postcss-loader!../../../packages/vars/src/colors-bluetint.css'; | ||
|
||
import click from '!!postcss-loader!./themes/click.css'; | ||
import mobile from '!!postcss-loader!./themes/mobile.css'; | ||
import corp from '!!postcss-loader!./themes/corp.css'; | ||
import site from '!!postcss-loader!./themes/site.css'; | ||
|
||
export const themes = { | ||
default: '', | ||
click, | ||
mobile, | ||
corp, | ||
site, | ||
}; | ||
|
||
export const THEME_DATA_ATTR = 'theme'; | ||
|
||
export function setThemeStylesInIframeHtmlPage() { | ||
const matches = /&theme=([^&]*)/.exec(document.location.search); | ||
|
||
if (matches) { | ||
setStyles(matches[1], document); | ||
} | ||
} | ||
|
||
export function getThemeStyles(theme) { | ||
return [themes[theme], theme === 'mobile' ? bluetintColors : ''].join('\n'); | ||
} | ||
|
||
export function setStyles(theme, doc) { | ||
getOrCreateStyleTag('theme', MODE_COLORS_TAG_ID, doc).innerHTML = getThemeStyles(theme); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
export const getStoryDoc = () => document.querySelector('iframe').contentDocument; | ||
|
||
export function getOrCreateStyleTag(id, beforeId, doc = getStoryDoc()) { | ||
const existingTag = doc.getElementById(id); | ||
if (existingTag) { | ||
return existingTag; | ||
} | ||
|
||
const styleTag = doc.createElement('style'); | ||
styleTag.id = id; | ||
|
||
const before = doc.getElementById(beforeId); | ||
|
||
if (before) { | ||
doc.head.insertBefore(styleTag, before); | ||
} else { | ||
doc.head.appendChild(styleTag); | ||
} | ||
|
||
return styleTag; | ||
} | ||
|
||
export const extractMixinContent = css => | ||
css | ||
.trim() | ||
.split('\n') | ||
.slice(1, -1) | ||
.join('\n'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.