Skip to content

Commit

Permalink
fix(theme): bring back the theme in the project
Browse files Browse the repository at this point in the history
  • Loading branch information
alecarn committed Jan 22, 2024
1 parent 836e92d commit 899030b
Show file tree
Hide file tree
Showing 28 changed files with 579 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/app/app.component.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import '@igo2/core/style/partial/core.variables';
@import '@igo2/core/partial/core.variables';
@import './pages/portal/portal.variables.scss';

$header-height: 72px;
Expand Down
2 changes: 1 addition & 1 deletion src/app/pages/header/header.component.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@use '@igo2/core/theming/prebuilt-themes/qcca';
@use '../../../theme/qcca';
@import '../portal/portal.variables.scss';

:host {
Expand Down
2 changes: 1 addition & 1 deletion src/app/pages/menu/menu-pages/map/map.variables.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@use 'variables';
@import '~@igo2/core/style/partial/media';
@import '~@igo2/core/partial/media';

$app-map-footer-height: 48px;
$app-map-mobile-min-space-right: 40px;
Expand Down
2 changes: 1 addition & 1 deletion src/app/pages/menu/menu.component.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@use 'sass:map';
@use '@igo2/core/theming/prebuilt-themes/qcca';
@use '../../../theme/qcca';
@import '../portal/portal.variables.scss';

:host {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import '@igo2/core/style/partial/core.variables';
@import '@igo2/core/partial/core.variables';

div {
box-sizing: border-box;
Expand Down
9 changes: 7 additions & 2 deletions src/app/pages/portal/portal.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,13 @@
}

igo-search-bar,
igo-search-results igo-list,
.baselayers {
igo-search-results igo-list {
left: $portal-left !important;
}

igo-baselayers-switcher {
position: absolute;
bottom: 8px;
left: $portal-left !important;
}

Expand Down
2 changes: 1 addition & 1 deletion src/app/pages/portal/portal.variables.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import '@igo2/core/style/partial/media';
@import '@igo2/core/partial/media';
@import 'variables';

$app-mobile-min-space-right: 40px;
Expand Down
2 changes: 1 addition & 1 deletion src/style/partial/variables.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import '@igo2/core/style/partial/core.variables';
@import '@igo2/core/partial/core.variables';

/*** Generic ***/
$app-background-color: rgb(255, 255, 255);
Expand Down
2 changes: 2 additions & 0 deletions src/theme/qcca/_index.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@forward './base';
@forward './components';
4 changes: 4 additions & 0 deletions src/theme/qcca/base/_index.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@forward './breakpoints';
@forward './colors' as colors-*;
@forward './palette';
@forward './typography';
57 changes: 57 additions & 0 deletions src/theme/qcca/base/breakpoints.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
@use 'sass:map';

// There is no standard for breakpoints for the Quebec.ca theme
// This is the Material breakpoint design by devices
$device-breakpoints: (
mobile: (
max: 599px
),
tablet: (
min: 600px,
max: 1239px
),
laptop: (
min: 1240px,
max: 1439px
),
desktop: (
min: 1440px
)
);

// Source: https://github.com/twbs/bootstrap/blob/main/scss/mixins/_breakpoints.scss
@function breakpoint-min($name, $breakpoints: $device-breakpoints) {
$min: map.get($breakpoints, $name, min);
@return if($min != 0, $min, null);
}

@function breakpoint-max($name, $breakpoints: $device-breakpoints) {
$max: map.get($breakpoints, $name, max);
@return if($max and $max > 0, $max, null);
}

// Media of at least the minimum breakpoint width. No query for the smallest breakpoint.
// Makes the @content apply to the given breakpoint and wider.
@mixin media-breakpoint-up($name, $breakpoints: $device-breakpoints) {
$min: breakpoint-min($name, $breakpoints);
@if $min {
@media (min-width: $min) {
@content;
}
} @else {
@content;
}
}

// Media of at most the maximum breakpoint width. No query for the largest breakpoint.
// Makes the @content apply to the given breakpoint and narrower.
@mixin media-breakpoint-down($name, $breakpoints: $device-breakpoints) {
$max: breakpoint-max($name, $breakpoints);
@if $max {
@media (max-width: $max) {
@content;
}
} @else {
@content;
}
}
40 changes: 40 additions & 0 deletions src/theme/qcca/base/colors.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
@use 'sass:map';

// https://design.quebec.ca/bases/couleurs#c118192
$colors: (
blue: (
light: #dae6f0,
light-2: #4a98d9,
normal: #1472bf,
normal-piv: #095797,
medium: #19406c,
dark: #223654
),
grey: (
light: #f1f1f2,
light-2: #c5cad2,
normal: #8893a2,
medium: #6b778a,
dark: #4e5662
),
red: (
pink-light: #ffdbd6,
pink: #e58271,
normal: #cb381f,
dark: #692519
),
green: (
light: #d7f0bb,
normal: #4f813d,
dark: #2c4024
),
yellow: (
light: #f8e69a,
normal: #e0ad03,
dark: #ad781c
)
);

@function get($color, $name) {
@return map.get($colors, $color, $name);
}
50 changes: 50 additions & 0 deletions src/theme/qcca/base/palette.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
@use 'sass:map';
@use 'sass:color';
@use './colors';

$blue-light: colors.get(blue, light);
$blue-light-2: colors.get(blue, light-2);
$blue-normal: colors.get(blue, normal);
$blue-normal-piv: colors.get(blue, normal-piv);
$blue-medium: colors.get(blue, medium);
$blue-dark: colors.get(blue, dark);

// Design Quebec colors
$primary: $blue-normal-piv;
$accent: colors.get(red, pink);

$dark-primary-text: $blue-dark;
$light-primary-text: white;

$palette: (
50: $blue-light,
100: color.adjust($blue-light-2, $lightness: 20%),
200: color.adjust($blue-light-2, $lightness: 10%),
300: $blue-light-2,
400: $blue-normal,
500: $primary,
600: color.adjust($primary, $lightness: -10%),
700: $blue-medium,
800: color.adjust($blue-medium, $lightness: -10%),
900: $blue-dark,
A100: $blue-normal,
A200: color.adjust($blue-normal, $lightness: 10%),
A400: colors.get(grey, light-2),
A700: colors.get(grey, light),
contrast: (
50: $dark-primary-text,
100: $dark-primary-text,
200: $dark-primary-text,
300: $dark-primary-text,
400: $dark-primary-text,
500: $light-primary-text,
600: $light-primary-text,
700: $light-primary-text,
800: $light-primary-text,
900: $light-primary-text,
A100: $dark-primary-text,
A200: $light-primary-text,
A400: $light-primary-text,
A700: $light-primary-text
)
);
2 changes: 2 additions & 0 deletions src/theme/qcca/base/typography/_index.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@forward './typography' as typo-*;
@forward './typography.utils';
138 changes: 138 additions & 0 deletions src/theme/qcca/base/typography/typography.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
@use 'sass:map';
@use '@angular/material' as mat;
@use '../palette';
@use '../breakpoints';
@use './typography.utils' as typo-utils;

// https://design.quebec.ca/bases/polices-caracteres
// https://design.quebec.ca/bases/niveaux-titres
// https://material.angular.io/guide/typography
$typography: mat.define-typography-config(
$font-family: '"Open Sans", sans-serif',
$headline-1: mat.define-typography-level(110px, 110px, 500),
$headline-2: mat.define-typography-level(54px, 54px, 500),
$headline-3: mat.define-typography-level(43px, 46px, 500),
$headline-4: mat.define-typography-level(32px, 38px, 500),
// h1
$headline-5: mat.define-typography-level(48px, 56px, bold),
// h2
$headline-6: mat.define-typography-level(36px, 40px, bold),
// h3
$subtitle-1: mat.define-typography-level(28px, 32px, bold),
// h4
$subtitle-2: mat.define-typography-level(21px, 24px, bold),
$body-1: mat.define-typography-level(16px, 24px, 400),
$body-2: mat.define-typography-level(12px, 18px, 400),
$caption: mat.define-typography-level(12px, 18px, 400),
$button: mat.define-typography-level(13px, 13px, 500)
);

$typography-mobile: mat.define-typography-config(
// h1
$headline-5: mat.define-typography-level(36px, 40px, bold),
// h2
$headline-6: mat.define-typography-level(28px, 32px, bold),
// h3
$subtitle-1: mat.define-typography-level(25px, 32px, bold)
);

$font-color: map.get(palette.$palette, 900);

@mixin set-base-styles {
body {
color: $font-color;
}

a {
word-break: break-word;
overflow-wrap: break-word;
cursor: pointer;
color: palette.$primary;
text-decoration: underline;
background-color: transparent;
}

p,
ul,
li,
u,
.text {
color: $font-color;
font-size: 16px;
line-height: 24px;
}

p {
margin-bottom: 24px;
}

strong {
font-weight: 600;
}

h1,
h2,
h3,
h4,
h5,
h6,
.h1,
.h2,
.h3,
.h4,
.h5,
.h6 {
font-family: Roboto, sans-serif !important;
color: $font-color;
}

h1 {
margin-top: 72px !important;
margin-bottom: 32px !important;

@include typo-utils.title-border;

@include breakpoints.media-breakpoint-down(tablet) {
margin-top: 48px !important;
margin-bottom: 16px !important;
}
}

h2 {
margin-top: 48px !important;
margin-bottom: 16px !important;
}

h3 {
margin-top: 24px !important;
margin-bottom: 16px !important;
}

// WORKAROUND, mat-typography area of intersection h4 is using mat-body-1
// https://github.com/angular/components/issues/26351
h4 {
@include typo-utils.title-level-4;
}

h4 {
margin-top: 24px !important;
margin-bottom: 8px !important;
}

h5 {
font-size: 19px !important;
line-height: 24px !important;
}

h6 {
font-size: 16px !important;
line-height: 20px !important;
}

h5,
h6 {
font-weight: bold !important;
margin-top: 16px !important;
margin-bottom: 0px !important;
}
}
18 changes: 18 additions & 0 deletions src/theme/qcca/base/typography/typography.utils.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
@use '../palette';

@mixin title-border {
&:after {
content: '';
display: block;
margin: 0;
width: 48px;
padding-top: 4px;
border-bottom: 4px solid palette.$accent;
}
}

@mixin title-level-4 {
font-size: 21px !important;
line-height: 24px !important;
font-weight: bold !important;
}
10 changes: 10 additions & 0 deletions src/theme/qcca/components/_index.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
@use './button';
@use './dialog';
@use './form-field';
@use './input';
@use './list';
@use './panel';
@use './search-bar';
@use './scrollbar';

@forward './_index.theme' as all-component-*;
5 changes: 5 additions & 0 deletions src/theme/qcca/components/_index.theme.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@use './search-bar.theme' as search-bar;

@mixin themes($theme) {
@include search-bar.theme($theme);
}
Loading

0 comments on commit 899030b

Please sign in to comment.