-
-
Notifications
You must be signed in to change notification settings - Fork 25
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
Base Style & Theme Setup #53
Milestone
Comments
This was referenced Dec 1, 2018
Closed
arcticicestudio
added a commit
that referenced
this issue
Dec 2, 2018
In order to use the fonts is must be added to Nord Docs theme. This commit implements the `typography` module that defines all used font families and the basic typography properties and values like the font size and units based on the used modular scale documented in GH-2. Associated epic: GH-2 Dependency of GH-53 GH-54
arcticicestudio
added a commit
that referenced
this issue
Dec 2, 2018
- babel-plugin-styled-components - gatsby-plugin-styled-components - polished - styled-components - styled-modern-normalize - styled-theming References: (1) https://www.npmjs.com/package/babel-plugin-styled-components (2) https://www.npmjs.com/package/gatsby-plugin-styled-components (3) https://www.npmjs.com/package/polished (4) https://www.npmjs.com/package/styled-components (5) https://www.npmjs.com/package/styled-modern-normalize (6) https://www.npmjs.com/package/styled-theming GH-53
arcticicestudio
added a commit
that referenced
this issue
Dec 2, 2018
arcticicestudio
added a commit
that referenced
this issue
Dec 2, 2018
This commit implements global and normalization CSS styles using "styled-components" `css` API. They extend "modern-normalize" and define, next to the browser normalization, styles for the available global themes. In order to use fonts in "Nord Docs" style & themes (implemented in GH-54) the basic properties and values have been added and integrated into these base styles. To inject global styles, styled-components v4 `createglobalstyle` (1) API has been used to create a `<GlobalStyle>` component that injects theme styles and "styled-modern-normalize" (2) globally. References: (1) https://www.styled-components.com/docs/api#createglobalstyle (2): https://github.com/arcticicestudio/styled-modern-normalize Associated epics: GH-51, GH-2 GH-53
arcticicestudio
added a commit
that referenced
this issue
Dec 2, 2018
To provide the global theme (1), the `ThemeProvider` (2) component has been implemented into the `Root` core container component (3). The global theme, placed in `src/styles/themes` is passed to the provider to make the theme globally available. References: (1) https://www.styled-components.com/docs/advanced#theming (2) https://www.styled-components.com/docs/api#themeprovider (3) #36 Associated epics: GH-51 GH-53
arcticicestudio
added a commit
that referenced
this issue
Dec 3, 2018
Jest uses a object called `global` that proxies the `window` object. This conflicts with the `global` object of Nord Docs theme. This commit renames the object to `globals`. GH-53
arcticicestudio
added a commit
that referenced
this issue
Dec 3, 2018
Instead of using the default entry point of the pakages defined in the `main` field the CSS modules should be imported directly. This fixes the imports for tests with Jest that are then handled with the implemented mock for file imports. It improves the DX by showing that these packages are CSS styles instead of a JS module and removes the need to add exception/ignore comments for ESLint. The only disadvantage it that it might be necessary to update the import when the package maintainer changes the `main` file when updating to a newer version. GH-53
arcticicestudio
added a commit
that referenced
this issue
Dec 3, 2018
Initially Nord Docs will be build with the "bright snow flurry" and "dark night frost" theme modes representing Nord "auras". The names have been implemented as constants to be used with the theme utility functions to define the styles of a component for each available global theme. GH-53
arcticicestudio
added a commit
that referenced
this issue
Dec 3, 2018
To simplify the usage of styled-theming's `theme()` (1) and `theme.variants()` API functions, two utility functions has been implemented: - `themeMode(modeStyles : object)` — Shorthand function for the `theme` API to define styles based on the global theme mode(s). - `themedModeVariant(modeStyles : object, variantPropName : string)` — Shorthand function for the `theme.variants` API to define variant styles based on the global theme mode(s). References: (1) https://github.com/styled-components/styled-theming#themename-values GH-53
arcticicestudio
added a commit
that referenced
this issue
Dec 3, 2018
Since the main JavaScript implementation of Nord (1) is currently not completed and released yet, the colors and palettes will be provided "manually" via new `nord` and `palettes` modules. As soon as the implementation has been done they will be replaced through imports from the official package. References: (1) nordtheme/nord#36 GH-53
arcticicestudio
added a commit
that referenced
this issue
Dec 3, 2018
This commit implements some basic configurations for motion related styles like animations inspired by "Material Designs" (1) great documentations and guidelines about motion speed (2). This includes values for speed like transition durations. It'll be used to set the CSS transition for the base background and font color within the `globals` CSS style module. References: (1) https://material.io (2) https://material.io/design/motion/speed.html GH-53
Merged
arcticicestudio
added a commit
that referenced
this issue
Dec 3, 2018
…and-theme-setup Base Style & Theme Setup
arcticicestudio
added a commit
that referenced
this issue
Dec 4, 2018
The `Root` component has been changed from a SFC to a class component to store the currently active state and handle the theme mode toggle logic through a function. It also migrated the currently used simple "styled-component" theme (1) (provided through the `<ThemeProvider` component) to the styled-theming theme (2) that provides the initially implemented theme (GH-53). References: (1) https://www.styled-components.com/docs/advanced#theming (2) https://github.com/styled-components/styled-theming Associated epic: GH-51 GH-57
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To start implementing components the basic styles must be set up. As documented in #51, Nord Docs will uses the CSS-in-JS library styled-components. To use uniform global theme definitions and to simplify CSS styling, the styled-theming and polished libraries will be integrated next to some useful and required specific Babel & Gatsby plugins.
Default Browser Style Normalization
The modern-normalize is a great project that normalizes the browsers default styles for a consistent appearance across different modern browsers. For the best usage with styled-components the npm-styled-modern-normalize project will be used. It exports the styles via the
css
API and will be added to the created global styles component mentioned above.CSS Tools
To simplify the CSS styling, the polished package will be used that provides a lightweight toolset for writing styles in JavaScript (CSS-in-JS).
CSS Base Styles
Global and normalization CSS styles will be implemented using styled-components
css
API. They extend modern-normalize and define, next to the browser normalization, styles of the available global themes like documented in the sections below.In order to use fonts in Nord Docs style & themes (implemented in #54) the basic properties and values must be added and integrated into this CSS base styles.
Global Styles
To inject global styles, styled-components v4
createglobalstyle
API will be used to create a<GlobalStyle>
component that can then be used to inject various styles globally.Global Themes
To provide the global theme, the
ThemeProvider
component will be added to the Nord DocsRoot
core container component. The global theme, placed insrc/styles/themes
will then be passed to the provider.Simplified Theme Usage
To simplify the usage of styled-theming's
theme()
andtheme.variants()
API functions, two utility functions will be implemented:themeMode(modeStyles : object)
— Shorthand function for thetheme
API to define styles based on the global theme mode(s).themedModeVariant(modeStyles : object, variantPropName : string)
— Shorthand function for thetheme.variants
API to define variant styles based on the global theme mode(s).Available Themes
Initially Nord Docs will be build with the “bright snow flurry” and “dark night frost” theme modes. The names will be implemented as constants with values
BRIGHT_SNOW_FLURRY
andDARK_NIGHT_FROST
to be used with the utility functions mentioned above to define the styles of a component for each available global theme.Plugins
styled-components great Babel plugin adds support for server-side rendering, minification of styles, and a nicer debugging experience. It will be integrated via the corresponding Gatsby's plugin.
Nord Colors
Since the main JavaScript implementation of Nord is currently not completed and released yet, the colors and palettes will be provided "manually" via the
nord
andpalettes
modules. As soon as the implementation has been done they will be replaced through imports from the official package.Motion
Some basic configurations for motion related styles like animations will be implemented inspired by Material Designs great documentation and guide about motion speed. This includes values for speed like transition durations. It'll be used to set the CSS transition for the base background and font color within the
globals
CSS style module.Tasks
css
API.<GlobalStyle>
component to injectstyled-modern-normalize
and CSS base styles.ThemeProvider
component toRoot
core container.themeMode
andthemeModeVariants
theme utility functions.BRIGHT_SNOW_FLURRY
andDARK_NIGHT_FROST
theme modes.nord
andpalettes
modules.The text was updated successfully, but these errors were encountered: