-
Notifications
You must be signed in to change notification settings - Fork 12
Refactor/to scss modular partials #243
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: refactor/styles-migration
Are you sure you want to change the base?
Changes from all commits
f37a21e
0039e71
0c75ed6
bd4e1aa
e76f338
3a96267
79e1ad5
cca9c5f
5318a8d
0810b3a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* | ||
* ThemeProvider Component | ||
* Purpose: | ||
* Injects a theme base on set theme value. | ||
* | ||
* Application: | ||
* Wrap to elements or components that needs the theme to be injected. | ||
*/ | ||
|
||
'use client'; | ||
|
||
import { isValidEnum } from '../../../utils/helpers/isValidEnum'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you should be able to import with the @symbol |
||
import { ThemeEnumValues } from '../../../enums/ThemeEnum'; | ||
|
||
const ThemeProvider = ({ theme, children }) => { | ||
return <div data-theme={isValidEnum(theme, ThemeEnumValues)}>{children}</div>; | ||
}; | ||
|
||
export { ThemeProvider }; |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe put in |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
* ThemeEnum | ||
* An immutable object that contains restricted values for data-theme. | ||
* | ||
* ThemeEnumValues | ||
* An immutable Set, with values from the ThemeEnum. | ||
* | ||
* Purpose: | ||
* To restrict values accepted by data-theme from the ThemeProvider component. | ||
* This will make sure that only valid values can be set to the ThemeProvider. | ||
*/ | ||
|
||
const ThemeEnum = Object.freeze({ | ||
Light: 'light', | ||
Dark: 'dark', | ||
// Monochrome: 'monochrome', | ||
// Protanopia: 'protanopia', | ||
// Deuteranopia: 'deuteranopia', | ||
// Tritanopia: 'tritanopia' | ||
}); | ||
|
||
const ThemeEnumValues = Object.freeze(new Set(Object.values(ThemeEnum))); | ||
|
||
export { ThemeEnum, ThemeEnumValues }; |
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
@use './themes'; | ||
@use './mixins'; | ||
@use './variables'; | ||
// Entry Point for CSS Resets and Theme Tokens. | ||
|
||
@use './partials/settings/themes'; | ||
@use './partials/settings/resets'; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/*** Media Query Mixins ***/ | ||
|
||
/* | ||
* Purpose: | ||
* Use for changing CSS property values to align with the current device view port. | ||
* | ||
* Application: | ||
* Use @include syntax to the element needing of responsive style changes. Define the properties | ||
* needed to be change and override, inside the media query mixin call(@include). | ||
*/ | ||
|
||
@use '../settings/breakpoints' as *; | ||
|
||
// Mobile | ||
@mixin media-mobile-sm { | ||
@media (max-width: $breakpoint-mobile-sm) { | ||
@content; | ||
} | ||
} | ||
|
||
@mixin media-mobile-lg { | ||
@media (max-width: $breakpoint-mobile-lg) { | ||
@content; | ||
} | ||
} | ||
|
||
// Tablet | ||
@mixin media-tablet-sm { | ||
@media (min-width: $breakpoint-tablet-sm) { | ||
@content; | ||
} | ||
} | ||
|
||
// Desktop | ||
@mixin media-desktop-sm-minus { | ||
@media (max-width: $breakpoint-desktop-sm-minus) { | ||
@content; | ||
} | ||
} | ||
|
||
@mixin media-desktop-sm { | ||
@media (min-width: $breakpoint-desktop-sm) { | ||
@content; | ||
} | ||
} | ||
|
||
@mixin media-desktop-sm-plus { | ||
@media (min-width: $breakpoint-desktop-sm-plus) { | ||
@content; | ||
} | ||
} | ||
|
||
@mixin media-desktop-md { | ||
@media (min-width: $breakpoint-desktop-md) { | ||
@content; | ||
} | ||
} | ||
|
||
@mixin media-desktop-lg { | ||
@media (min-width: $breakpoint-desktop-lg) { | ||
@content; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/*** Transition Mixins ***/ | ||
|
||
/* | ||
* Purpose: | ||
* Ensures that the transition property works across on multiple browsers, older or modern versions. | ||
* | ||
* Application: | ||
* Use directly to elements needing of transitional effects. Use @include syntax and fill-up arguments | ||
* based on your need. | ||
*/ | ||
|
||
@mixin transition($args...) { | ||
-webkit-transition: $args; | ||
-moz-transition: $args; | ||
-ms-transition: $args; | ||
-o-transition: $args; | ||
transition: $args; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/*** Typography Mixins ***/ | ||
|
||
/* | ||
* Purpose: | ||
* Use to style typographic elements. Ensures typography elements aligns with the WDP Style Guide | ||
* and avoid descrepancies on typography styles. | ||
* | ||
* Application: | ||
* Use directly to typographic elements. Use @include syntax to inject the properties needed. | ||
*/ | ||
|
||
@use '../settings/fonts' as *; | ||
|
||
@mixin typography-header-page { | ||
font-family: $font-family-primary; | ||
font-size: $font-size-lg; | ||
font-weight: $font-weight-bold; | ||
line-height: $line-height-lg; | ||
} | ||
|
||
@mixin typography-header-sub { | ||
font-family: $font-family-primary; | ||
font-size: $font-size-md; | ||
font-weight: $font-weight-bold; | ||
line-height: $line-height-md; | ||
} | ||
|
||
@mixin typography-copy { | ||
font-family: $font-family-secondary; | ||
font-size: $font-size-sm; | ||
font-weight: $font-weight-regular; | ||
line-height: $line-height-sm; | ||
} | ||
|
||
@mixin typography-label { | ||
@include typography-copy; | ||
} | ||
|
||
@mixin typography-input { | ||
@include typography-copy; | ||
} | ||
|
||
@mixin typography-placeholder { | ||
@include typography-copy; | ||
} | ||
|
||
@mixin typography-link { | ||
@include typography-copy; | ||
} | ||
|
||
@mixin typography-button { | ||
@include typography-copy; | ||
} | ||
|
||
// Font Related Changes Only (Family, Weight, Size, Line Height, etc.) | ||
@mixin typography-action-hover($type) { | ||
@if ($type == 'pageheader') { | ||
} @else if($type == 'subheader') { | ||
// >>>> Insert Property Changes Here <<<< | ||
} @else if($type == 'paragraph') { | ||
// >>>> Insert Property Changes Here <<<< | ||
} @else if($type == 'label' or $type == 'link' or $type == 'button') { | ||
// >>>> Insert Property Changes Here <<<< | ||
} @else { | ||
// Catch Unknown Argument Value | ||
@error "Unknown Argument Value("#{$type}"): Must be either 'pageheader', 'subheader', 'paragraph', 'label', 'link', or 'button' only."; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/*** Breakpoint Settings ***/ | ||
|
||
// Breakpoint Tokens | ||
// Mobile | ||
$breakpoint-mobile-sm: 350px; // $sm-mobile-breakpoint | ||
$breakpoint-mobile-md: 578px; // $mobile-breakpoint /* UNUSED */ | ||
$breakpoint-mobile-lg: 767px; // $lg-mobile-breakpoint | ||
|
||
// Tablet | ||
$breakpoint-tablet-sm: 768px; // $tablet-breakpoint | ||
|
||
// Desktop | ||
$breakpoint-desktop-sm-minus: 1023px; // $desktop-breakpoint-minus | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we can probably remove all the old names in comments, they look similar enough. We can also wait till before we merge into main |
||
$breakpoint-desktop-sm: 1024px; // $desktop-breakpoint | ||
$breakpoint-desktop-sm-plus: 1025px; // $desktop-breakpoint-plus | ||
$breakpoint-desktop-md: 1250px; // $medium-desktop-breakpoint | ||
$breakpoint-desktop-lg: 1440px; // $large-desktop-breakpoint | ||
$breakpoint-desktop-xl: 2560px; // $extra-large-breakpoint |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/*** Color Settings ***/ | ||
|
||
/* | ||
* Important: | ||
* Do not use these variables directly to style elements. | ||
* | ||
* Purpose: | ||
* This is for setting up the base colors only. All of these variables are linked to the | ||
* CSS variables Theme Tokens (_themes.scss), use those for styling elements instead. | ||
* | ||
* Application: | ||
* Use these base color variables to assign values on Theme Tokens(_themes.scss). | ||
* | ||
* Linking Setup: | ||
* Base Colors(_colors.scss) -> Theme Tokens(_themes.scss) | ||
*/ | ||
|
||
// Base Colors Light | ||
$color-white: #ffffff; | ||
$color-graphite: #292929; | ||
$color-yellow: #ffcc4c; | ||
$color-baby-blue: #8cd5e8; | ||
$color-medium-blue: #19aad1; | ||
$color-dark-blue: #023047; | ||
|
||
// Base Colors Dark **Temporary Colors: For testing purposes only; Change accordingly.** | ||
$color-black: #050505; | ||
$color-cement: #777777; | ||
$color-light-yellow: #ffecbc; | ||
$color-adult-blue: #2b89a0; | ||
$color-lumen-blue: #7bd6f0; | ||
$color-light-blue: #0ca0eb; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe create a
theme
folder and put the themeprovider in there.or even put in
styles
ThemeProviders are not typically considered "containers"