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

Split out Font Awesome into separate CSS file, optimise colours #76

Merged
merged 2 commits into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions .storybook/preview.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import "../src/nationalarchives/all.scss";
import "../src/nationalarchives/font-awesome.scss";
import { a11yConfig } from "./storybook-config";
import { customViewports } from "./viewports";
import Cookies from "../src/nationalarchives/lib/cookies.mjs";

document.documentElement.classList.add(
"tna-template",
"tna-template--light-theme",
"tna-template--yellow-accent",
);
if (window.self !== window.top) {
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Set smaller minimum width for search field inputs
- Added more space between the text and chevron in a heading link
- Split out Font Awesome into a separate CSS file

### Deprecated
### Removed
Expand Down
1 change: 0 additions & 1 deletion src/nationalarchives/all.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,5 @@

@use "variables";
@use "tools";
@use "lib";
@use "utilities";
@use "components";
6 changes: 6 additions & 0 deletions src/nationalarchives/font-awesome.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
@use "variables/assets";

$fa-font-path: assets.$fa-font-path;
@import "lib/font-awesome/fontawesome";
@import "lib/font-awesome/solid";
@import "lib/font-awesome/brands";
6 changes: 0 additions & 6 deletions src/nationalarchives/lib/_font-awesome.scss

This file was deleted.

1 change: 0 additions & 1 deletion src/nationalarchives/lib/_index.scss

This file was deleted.

46 changes: 25 additions & 21 deletions src/nationalarchives/tools/_colour.scss
Original file line number Diff line number Diff line change
Expand Up @@ -150,18 +150,38 @@
fill: var(--#{$colour}) if($important, !important, null);
}

%light {
@include colour-css-vars;

@media (prefers-contrast: more) {
@include colour-css-vars-high-contrast;
}
}

@mixin light {
@extend %light;
}

%dark {
@include colour-css-vars-dark;

@media (prefers-contrast: more) {
@include colour-css-vars-high-contrast-dark;
}
}

@mixin dark {
@extend %dark;
}

%plain {
.tna-template--system-theme & {
@include colour-css-vars;
@extend %light;

@media (prefers-color-scheme: dark) {
@include colour-css-vars-dark;
}

@media (prefers-contrast: more) {
@include colour-css-vars-high-contrast;
}

@media (prefers-contrast: more) and (prefers-color-scheme: dark) {
@include colour-css-vars-high-contrast-dark;
}
Expand Down Expand Up @@ -190,22 +210,6 @@
@extend %plain;
}

@mixin light {
@include colour-css-vars;

@media (prefers-contrast: more) {
@include colour-css-vars-high-contrast;
}
}

@mixin dark {
@include colour-css-vars-dark;

@media (prefers-contrast: more) {
@include colour-css-vars-high-contrast-dark;
}
}

%contrast {
--background: var(--contrast-background);
--font-base: var(--contrast-font-base);
Expand Down
6 changes: 3 additions & 3 deletions src/nationalarchives/utilities/_colour.scss
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
@use "../tools/colour";

:root {
@include colour.colour-css-vars;
}
// :root {
// @include colour.colour-css-vars;
// }

.tna-template {
@include colour.colour-background("page-background");
Expand Down
6 changes: 6 additions & 0 deletions tasks/test-package.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ const checkExists = [
"nationalarchives/all.js.map",
"nationalarchives/all.mjs",
"nationalarchives/all.scss",
"nationalarchives/font-awesome.css",
"nationalarchives/font-awesome.css.map",
"nationalarchives/font-awesome.scss",
"nationalarchives/prototype-kit.css",
"nationalarchives/prototype-kit.css.map",
"nationalarchives/prototype-kit.scss",
// Assets
"nationalarchives/assets/fonts/fa-brands-400.ttf",
"nationalarchives/assets/fonts/fa-brands-400.woff2",
Expand Down