` and then in a `` element.
40 |
41 | {% notice "Attention" %}
42 | Thou shalt not use these elements to provide formatting, but semantics.
43 | {% endnotice %}
44 |
45 | {% example "code-quotes" %}
46 | This paragraph has inline code
.
47 | This is a code block
48 |
49 |
50 | This is a quote
51 |
52 | {% endexample %}
53 |
54 | ## Insertion and deletion
55 |
56 | Co-Design supports standard styles for `` and ``, which should be used to mark that something has been changed (for example in a revision history).
57 |
58 | {% example "ins-del" %}
59 | Co-Design is niceawesome .
60 | {% endexample %}
61 |
62 | ## Details and Summary
63 |
64 | Co-Design has default styles for `` (with ``) elements. These are used to collapse certain parts of the site.
65 |
66 | {% example "details-summary" %}
67 |
68 |
69 | Lorem ipsum dolor sit amet consectetur adipisicing elit. Ab nemo, quae, explicabo doloribus quos corporis omnis error ipsum ex quia voluptatibus consectetur neque natus quisquam nulla sunt non impedit ducimus.
70 |
71 |
72 | Lorem, ipsum dolor sit amet consectetur adipisicing elit. Beatae sequi quam sit magni neque repellat, natus debitis necessitatibus a, maxime placeat doloribus alias nobis perferendis non excepturi tenetur, quos porro! Lorem ipsum dolor sit, amet consectetur adipisicing elit. Ut magnam fugit tempora deserunt sint vel aperiam nemo reiciendis perferendis! Exercitationem culpa velit labore doloribus et quae at commodi porro dicta? Lorem ipsum dolor sit amet consectetur adipisicing elit. Veniam consectetur rerum, unde minima reprehenderit laboriosam fugiat deserunt animi? Tenetur sit nisi magnam quis dolorem eius recusandae possimus distinctio, error incidunt! Lorem ipsum dolor sit amet consectetur adipisicing elit. Mollitia dolor suscipit laudantium ipsam iste ipsa nobis obcaecati impedit sequi exercitationem, quasi rerum repellat omnis, aliquam accusantium at provident eum recusandae? Lorem ipsum dolor sit amet consectetur adipisicing elit. Pariatur eos asperiores est ea aliquam aut quasi at ratione similique suscipit laboriosam cupiditate, esse nesciunt, aperiam odio numquam quae soluta cumque!
73 |
74 |
75 | {% endexample %}
--------------------------------------------------------------------------------
/docs_src/utilities/index.md:
--------------------------------------------------------------------------------
1 | ---
2 | layout: page
3 | title: Utilities
4 | ---
5 |
6 | Co-Design uses "atomic classes" to allow you to specifically modify the presentation of individual elements.
7 |
8 | You should be able to create most layouts with these utilities, however some patterns are often repeated. For these, we offer [components](/components). You can, though, override the components with these atomic classes.
9 |
10 | Click on any of the entries in the menu, in order to show the utilities for that design area.
11 |
12 | Utilities commonly follow the pattern of `.has-[property]-[value]`. In these cases, there's always a short form, which is following the pattern `.h-[property-abbreviation]-[value]`.
--------------------------------------------------------------------------------
/docs_src/utilities/javascript.md:
--------------------------------------------------------------------------------
1 | ---
2 | layout: page
3 | title: JavaScript
4 | description: Co-Design comes with a standard JavaScript library, which should allow you to do many things without writing a single line of JavaScript yourself.
5 | ---
6 |
7 | To be able to use this JavaScript, you'll need to include it into your project. See the [installation guide](/setup/installation) for more information.
8 |
9 | ## Components
10 |
11 | Co-Design will provide JavaScript controllers to every module, which is in need of one. See the respective component page for details:
12 |
13 | - [Header](/components/header)
14 | - [Modals](/components/modals)
15 | - [Drop Panels](/components/drop-panels)
16 |
17 | ## Utilities
18 |
19 | Furthermore, Co-Design JavaScript provides some commonly used utilities:
20 |
21 | ### Toggle
22 |
23 | Co-Design JS supports toggling various aspects of target elements. To create a toggle, you need to give the trigger these three attributes:
24 |
25 | - `data-toggle` with a CSS selector selecting the target
26 | - `data-toggle-property` with a name of the property to be toggled (defaults to: display)
27 | - `data-toggle-value` with a name of the value of the property to be toggled. (defaults to: `\auto`)
28 |
29 | There are these properties:
30 |
31 | - **display** - toggles, whether the element is visible or not
32 | - **class** - toggles, whether the element has one or many class (defined by value, separated by space) or not.
33 |
34 | {% example "toggle-display" %}
35 |
37 | Toggle Example
38 |
39 | This paragraph can be toggled.
40 | {% endexample %}
41 |
42 | {% example "toggle-class" %}
43 |
47 | Toggle Example
48 |
49 | This paragraph can be toggled.
50 | {% endexample %}
51 |
52 | ### Dismiss
53 |
54 | Co-Design JS supports dismissing target elements. To create a dismisser, you need to give the trigger these attributes:
55 |
56 | - `data-dismiss` with a CSS selector selecting the target
57 | - (optionally) `data-dismiss-soft` for a more soft dismissal (first decrease opacity)
58 |
59 | {% example "dismiss" %}
60 | Click the close button to remove the notice:
61 |
62 |
63 | ×
64 | Something important happened!
65 |
66 |
67 |
68 | ×
69 | Something important happened! (soft dismiss)
70 |
71 | {% endexample %}
--------------------------------------------------------------------------------
/docs_src/utilities/layout.md:
--------------------------------------------------------------------------------
1 | ---
2 | layout: page
3 | title: Layout utilities
4 | description: There are different layout utilities, that allow you to change everything that relates to the layout and position of elements.
5 | ---
6 |
7 | ## Layout container
8 |
9 | It is recommended for readability not to have full-width containers with content, but instead to give them a maximum width and to center them. You can look at the header and this content area to see the effect.
10 |
11 | To do so, you need to add the `.container` class. By default, the width of it is 72rem, however you can override that in your "_child.scss".
12 |
13 | ## Element float
14 |
15 | You can make elements float to the left or to the right, by giving them the classes `.has-float-left` or `.has-float-right`, respectively. You can remove the float from an element with `.has-float-none` and clear the float around an element with `.has-float-clear`.
16 |
17 | ## Flexbox grid
18 |
19 | Co-Design provides a flexible and powerful CSS flexbox grid. It must be in a `.grid` container and each item (cell) must have the class `.grid--cell`.
20 |
21 | Then you can add any of the classes `.is-X` with X between one and twelve (or any other number if you override it in the "_child.scss"). Furthermore we have responsive grid classes with `.is-X-sm`, `.is-X-md` and `.is-X-lg`, being effective only, when the viewport size is under 32rem, between 32rem and 64rem or above 64rem, respectively.
22 |
23 | By default, the elements of a grid are put on the next line, when there isn't enough space (wrap). However, sometimes that isn't wanted. For these cases, it's possible to add the class `.is-nowrap` to the grid.
24 |
25 | {% example "grid" "Resize the browser window to see the responsive classes in effect." %}
26 |
40 | {% endexample %}
--------------------------------------------------------------------------------
/docs_src/utilities/typography.md:
--------------------------------------------------------------------------------
1 | ---
2 | layout: page
3 | title: Typographic utilities
4 | description: There are different typographic utilities, that allow you to change font-related properties of elements.
5 | ---
6 |
7 | ## Font size
8 |
9 | You can set the `font-size` to any of a list of "named" values. This is called a "gradient" in our framework. Unless you override it in the "_child.scss", you can use the following values:
10 |
11 |
12 |
13 | name
14 | value
15 | default for
16 |
17 |
18 | small
19 | 12px
20 | h6
21 |
22 |
23 | caption
24 | 14px
25 | h5
26 |
27 |
28 | base
29 | 16px
30 | any text and h4
31 |
32 |
33 | larger
34 | 19px
35 | h3
36 |
37 |
38 | subheading
39 | 22px
40 |
41 |
42 |
43 | heading
44 | 25px
45 | h2
46 |
47 |
48 | subtitle
49 | 28px
50 |
51 |
52 |
53 | title
54 | 31px
55 | h1
56 |
57 |
58 | subdisplay
59 | 34px
60 |
61 |
62 |
63 | display
64 | 37px
65 |
66 |
67 |
68 |
69 | To set the font size, you need to give the element the class `has-font-size-X`, where X is replaced with the font-size name.
70 |
71 | {% example "font-size" %}
72 | 3 questions
73 | matched your query
74 | {% endexample %}
75 |
76 |
77 |
78 | ## Font family
79 |
80 | You can set the `font-family` to either "primary" (the default sans serif font), "brand" (the sans serif font used in headers and other branding-specific components) or "code" (the monospace font). Unless you override it in the "_child.scss", each option uses this font stack:
81 |
82 |
83 |
84 | option
85 | fonts
86 |
87 |
88 | primary
89 | "Roboto", "Open Sans", "Helvetica Neue", "Helvetica", "Arial", sans-serif
90 |
91 |
92 | brand
93 | "Red Hat Display", "Open Sans", "Helvetica Neue", "Helvetica", "Arial", sans-serif
94 |
95 |
96 | code
97 | "Consolas", "Courier New", monospace
98 |
99 |
100 |
101 | To set the font family, you need to give the element the class `has-font-family-X`, where X is replaced with the font stack name.
102 |
103 | {% example "font-family" %}
104 | This is the primary font.
105 | This is the brand font..
106 | This is the code font.
107 | {% endexample %}
108 |
109 |
110 | ## Font decoration
111 |
112 | It is possible to override the font weight and whether it is italic for an element.
113 |
114 | You have the classes `has-font-weight-normal`, `has-font-weight-medium`, `has-font-weight-bold` and `has-font-weight-black` for font-weight and `has-font-style-normal` and `has-font-weight-italic` for italic style or not.
115 |
116 | {% example "font-decoration" %}
117 | This is normal
118 | This is medium
119 | This is bold
120 | This is black
121 |
122 | This is italic
123 | This is black and italic
124 | {% endexample %}
125 |
126 | ## Text align
127 | It is possible to override the text alignment for an element.
128 |
129 | You have the classes `has-text-align-left`, `has-text-align-center`, `has-text-align-right` and `has-text-align-justify`, which determine, whether the text in an element is on the left, centered, on the right or justified, respectively. Justification should not be used in the most cases, though.
130 |
131 | {% example "text-align" %}
132 | Left aligned. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut
133 | Centered. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut.
134 | Right aligned. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut
135 | Justified. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut
136 | {% endexample %}
--------------------------------------------------------------------------------
/js_src/co-design.ts:
--------------------------------------------------------------------------------
1 | import Toggle from "./toggle.js";
2 | import Dismiss from "./dismiss.js";
3 | import Header from "./header.js";
4 | import DropPanel from "./droppanel.js";
5 | import { Modal, ModalToggle } from "./modal.js";
6 |
7 | const toggles = Toggle.find("[data-toggle]");
8 | const dismiss = Dismiss.find("[data-dismiss]");
9 | const modals = ModalToggle.find("[data-modal]");
10 | const drops = DropPanel.find("[data-drop]");
11 | Header.apply();
12 |
13 | const delegated = {
14 | 'toggle': [Toggle, toggles],
15 | 'dismiss': [Dismiss, dismiss],
16 | 'modal': [ModalToggle, modals],
17 | 'drop': [DropPanel, drops]
18 | };
19 | document.addEventListener('click', ev => {
20 | const target: HTMLElement = ev.target as HTMLElement;
21 | Object.keys(delegated).forEach(key => {
22 | if (target.hasAttribute(`data-${key}`)) {
23 | const existing = delegated[key][1].filter(x => x.element === target);
24 | if (existing.length === 0) {
25 | delegated[key][1].push(new delegated[key][0](target));
26 | const redispatch = new MouseEvent(ev.type, ev);
27 | target.dispatchEvent(redispatch);
28 | }
29 | }
30 | });
31 | });
32 |
--------------------------------------------------------------------------------
/js_src/dismiss.ts:
--------------------------------------------------------------------------------
1 | export default class Dismiss {
2 | private readonly refersToElement: HTMLElement;
3 | private readonly doesSoftDismiss: boolean;
4 |
5 | public static softDismissDurationinMilliseconds: number = 250; // ms
6 |
7 | constructor(public readonly element: HTMLElement) {
8 | this.refersToElement = document.querySelector(element.getAttribute("data-dismiss"));
9 |
10 | if (this.refersToElement == null) {
11 | throw "Missing target for dismiss: " + element.getAttribute("data-dismiss");
12 | }
13 |
14 | this.doesSoftDismiss = element.hasAttribute("data-dismiss-soft");
15 |
16 | element.addEventListener("click", (e) => { this.dismiss(); e.preventDefault(); });
17 | }
18 |
19 | private dismiss() {
20 | // Remove immediately, if no support for animate
21 | if (!this.doesSoftDismiss || !this.refersToElement.animate) {
22 | this.refersToElement.remove();
23 | } else {
24 | this.refersToElement.animate([
25 | { opacity: 1.0 },
26 | { opacity: 0 }
27 | ], {
28 | duration: Dismiss.softDismissDurationinMilliseconds
29 | });
30 | setTimeout(() => {
31 | this.refersToElement.remove();
32 | }, Dismiss.softDismissDurationinMilliseconds)
33 | }
34 | }
35 |
36 | static find(query: string) {
37 | const elements = document.querySelectorAll(query);
38 | let dismisses = [];
39 | for (let i = 0; i < elements.length; i++) {
40 | dismisses.push(new Dismiss(elements[i] as HTMLElement));
41 | }
42 | return dismisses;
43 | }
44 | };
45 |
--------------------------------------------------------------------------------
/js_src/droppanel.ts:
--------------------------------------------------------------------------------
1 | export default class DropPanel {
2 | private readonly refersToElement: HTMLElement;
3 | private readonly elementActiveClass: string;
4 | private readonly forcedDirection: string;
5 | private readonly panelTriggerNode: HTMLElement;
6 |
7 | public static offsetInPixel: number = 2;
8 |
9 | constructor(public readonly element: HTMLElement) {
10 | this.panelTriggerNode = element;
11 | this.refersToElement = document.querySelector(element.getAttribute("data-drop"));
12 |
13 | if (this.refersToElement == null) {
14 | throw "Missing target for DropPanel: " + element.getAttribute("data-drop");
15 | }
16 |
17 | this.elementActiveClass = element.hasAttribute("data-drop-self-class-toggle") ? element.getAttribute("data-drop-self-class-toggle") : null;
18 | this.forcedDirection = element.hasAttribute("data-drop-force-dir") ? element.getAttribute("data-drop-force-dir") : null;
19 |
20 | this.closePanelOnClickOutside();
21 | element.addEventListener("click", (e) => { this.toggleDropPanel(); e.preventDefault(); });
22 | }
23 |
24 | private toggleDropPanel() {
25 | this.refersToElement.classList.toggle("is-active");
26 |
27 | if (this.elementActiveClass) {
28 | this.element.classList.toggle(this.elementActiveClass);
29 | }
30 |
31 | if (this.refersToElement.classList.contains("is-active")) {
32 | // Reset all properties to prevent unexpected heights/widths
33 | this.refersToElement.style.top = null;
34 | this.refersToElement.style.bottom = null;
35 | this.refersToElement.style.left = null;
36 | this.refersToElement.style.right = null;
37 |
38 | // Position header slide appropriately relative to
39 | // trigger.
40 | // If the item is more on the left: left-align, if
41 | // it is more on the right: right-align.
42 | // Same for top vs bottom
43 | const rect = this.element.getBoundingClientRect();
44 |
45 | // check, whether the trigger is more on the left or on the right
46 | const isRight: boolean = (rect.left + rect.width / 2) > document.body.clientWidth / 2;
47 |
48 | const refersToElementWidth = this.refersToElement.getBoundingClientRect().width;
49 | const refersToElementHeight = this.refersToElement.getBoundingClientRect().height;
50 | let offset: number = 0;
51 | if (isRight) {
52 | this.refersToElement.style.right = (document.body.clientWidth - rect.right) + "px";
53 | } else {
54 | this.refersToElement.style.left = (rect.left) + "px";
55 | }
56 | if (document.body.clientWidth < (refersToElementWidth + offset)) {
57 | this.refersToElement.style.left = "0px";
58 | this.refersToElement.style.right = "0px";
59 | this.refersToElement.style.maxWidth = "100%";
60 | }
61 |
62 | let isTop: boolean;
63 | if (this.forcedDirection == "up") {
64 | isTop = false;
65 | } else if (this.forcedDirection == "down") {
66 | isTop = true;
67 | } else {
68 | // check, whether the trigger is more on the top or on the bottom
69 | isTop = (rect.top + rect.height / 2) <= (window.innerHeight) / 2;
70 | }
71 |
72 | if (isTop) {
73 | this.refersToElement.style.top = (rect.bottom + window.scrollY + DropPanel.offsetInPixel) + "px";
74 | } else {
75 | this.refersToElement.style.bottom = (window.innerHeight - window.scrollY - rect.top + DropPanel.offsetInPixel) + "px";
76 | }
77 | }
78 | }
79 |
80 | private closePanelOnClickOutside() {
81 | const dropPanelSelector = this.panelTriggerNode.getAttribute("data-drop");
82 | document.addEventListener("click", (e) => {
83 | const target = e.target as HTMLElement;
84 | const parentDropdown = target.closest(dropPanelSelector);
85 | if(parentDropdown !== this.refersToElement && !this.panelTriggerNode.contains(target)) {
86 | this.closeDropPanel();
87 | }
88 | });
89 | }
90 |
91 | private closeDropPanel() {
92 | this.refersToElement.classList.remove("is-active");
93 | if (this.elementActiveClass) {
94 | this.element.classList.remove(this.elementActiveClass);
95 | }
96 | }
97 |
98 | static find(query: string) {
99 | const elements = document.querySelectorAll(query);
100 | let DropPanels = [];
101 | for (let i = 0; i < elements.length; i++) {
102 | DropPanels.push(new DropPanel(elements[i] as HTMLElement));
103 | }
104 | return DropPanels;
105 | }
106 | };
107 |
--------------------------------------------------------------------------------
/js_src/header.ts:
--------------------------------------------------------------------------------
1 | export default class Header {
2 | constructor(public readonly element: HTMLElement) {
3 | HeaderSlideToggle.find(element, "[data-header-slide]");
4 | }
5 |
6 | static apply() {
7 | const elements = document.querySelectorAll(".header");
8 | let headers = [];
9 | for (let i = 0; i < elements.length; i++) {
10 | headers.push(new Header(elements[i] as HTMLElement));
11 | }
12 | return headers;
13 | }
14 | };
15 |
16 | export class HeaderSlideToggle {
17 | private readonly refersToElement: HTMLElement;
18 | private readonly slideTriggerNode: HTMLElement;
19 |
20 | constructor(public readonly element: HTMLElement) {
21 | this.slideTriggerNode = element;
22 | this.refersToElement = document.querySelector(element.getAttribute("data-header-slide"));
23 |
24 | if (this.refersToElement == null) {
25 | throw "Missing target for dismiss: " + element.getAttribute("data-dismiss");
26 | }
27 |
28 | this.closeSlideOnClickOutside();
29 | element.addEventListener("click", (e) => { this.toggle(); e.preventDefault(); });
30 | }
31 |
32 | private toggle() {
33 | this.refersToElement.classList.toggle("is-active");
34 | this.element.classList.toggle("is-active");
35 |
36 | // Position header slide appropriately relative to
37 | // trigger.
38 | // If the item is more on the left: left-align, if
39 | // it is more on the right: right-align.
40 | const rect = this.element.getBoundingClientRect();
41 | this.refersToElement.style.top = (window.scrollY + rect.top + rect.height) + "px";
42 |
43 | // reset max width, left and right
44 | this.refersToElement.style.maxWidth = "";
45 | this.refersToElement.style.left = "";
46 | this.refersToElement.style.right = "";
47 |
48 | // check, whether the trigger is more on the left or on the right
49 | const isRight: boolean = (rect.left + rect.width / 2) > document.body.clientWidth / 2;
50 | const refersToElementWidth = this.refersToElement.getBoundingClientRect().width;
51 | let offset: number = 0;
52 | if (isRight) {
53 | this.refersToElement.style.right = (document.body.clientWidth - rect.right) + "px";
54 | offset = document.body.clientWidth - rect.right;
55 | } else {
56 | this.refersToElement.style.left = (rect.left) + "px";
57 | offset = rect.left;
58 | }
59 | if (document.body.clientWidth < (refersToElementWidth + offset)) {
60 | this.refersToElement.style.left = "0px";
61 | this.refersToElement.style.right = "0px";
62 | this.refersToElement.style.maxWidth = "100%";
63 | }
64 | }
65 |
66 | private closeSlide() {
67 | this.refersToElement.classList.remove("is-active");
68 | this.element.classList.remove("is-active");
69 | }
70 |
71 | private closeSlideOnClickOutside() {
72 | const slideSelector = this.slideTriggerNode.getAttribute("data-header-slide");
73 | document.addEventListener("click", (e) => {
74 | const target = e.target as HTMLElement;
75 | const parentSlide = target.closest(slideSelector);
76 | if (parentSlide !== this.refersToElement && !this.slideTriggerNode.contains(target)) {
77 | this.closeSlide();
78 | }
79 | });
80 | }
81 |
82 | static find(container: HTMLElement, query: string) {
83 | const elements = container.querySelectorAll(query);
84 | let headerslidetoggles = [];
85 | for (let i = 0; i < elements.length; i++) {
86 | headerslidetoggles.push(new HeaderSlideToggle(elements[i] as HTMLElement));
87 | }
88 | return headerslidetoggles;
89 | }
90 | };
91 |
--------------------------------------------------------------------------------
/js_src/modal.ts:
--------------------------------------------------------------------------------
1 | class Modal {
2 | public readonly isPositionedAbsolute: boolean;
3 | public readonly isDanger: boolean;
4 |
5 | constructor(public readonly element: HTMLElement ) {
6 | this.isPositionedAbsolute = this.element.classList.contains("is-with-backdrop");
7 | this.isDanger = this.element.classList.contains("is-danger");
8 | }
9 |
10 | public toggle() {
11 | if (!this.isPositionedAbsolute) {
12 | this.element.style.top = document.scrollingElement.scrollTop + "px";
13 | }
14 |
15 | this.element.classList.toggle("is-active");
16 | }
17 |
18 | static find(query: string) {
19 | const elements = document.querySelectorAll(query);
20 | let toggles = [];
21 | for (let i = 0; i < elements.length; i++) {
22 | toggles.push(new Modal(elements[i] as HTMLElement));
23 | }
24 | return toggles;
25 | }
26 | };
27 |
28 | class ModalToggle {
29 | private readonly modal: Modal;
30 | private readonly isPositionedAbsolute: boolean;
31 |
32 | constructor(public readonly element: HTMLElement) {
33 | this.modal = new Modal(document.querySelector(element.getAttribute("data-modal")));
34 |
35 | element.addEventListener("click", (e) => { this.modal.toggle(); e.preventDefault(); });
36 | }
37 |
38 | static find(query: string) {
39 | const elements = document.querySelectorAll(query);
40 | let modaltoggles = [];
41 | for (let i = 0; i < elements.length; i++) {
42 | modaltoggles.push(new ModalToggle(elements[i] as HTMLElement));
43 | }
44 | return modaltoggles;
45 | }
46 | };
47 |
48 | export {
49 | ModalToggle,
50 | Modal
51 | };
52 |
--------------------------------------------------------------------------------
/js_src/toggle.ts:
--------------------------------------------------------------------------------
1 | const toggleProperties = {
2 | /* "display" is for toggling, whether an element is displayed or not */
3 | display: {
4 | getValue: (el, value) => el.style.display,
5 | toggle: (el, value, defaultValue) => {
6 | el.style.display = (el.style.display == "none") ? defaultValue : "none";
7 | }
8 | },
9 |
10 | /* "class" is for toggling, whether an element has a specified class or not */
11 | class: {
12 | getValue: (el, value) => { value.split(" ").map((i) => [i, el.classList.contains(i)]) },
13 | toggle: (el, value, defaultValue) => {
14 | value.split(" ").forEach(
15 | (className) => el.classList.toggle(className)
16 | );
17 | }
18 | }
19 | };
20 |
21 | export default class Toggle {
22 | private readonly refersToElement: HTMLElement;
23 | private readonly refersToProperty: string;
24 | private readonly refersToValue: string;
25 | private readonly defaultValue: any;
26 |
27 | constructor(public readonly element: HTMLElement) {
28 | this.refersToElement = document.querySelector(element.getAttribute("data-toggle"));
29 |
30 | if (this.refersToElement == null) {
31 | throw "Missing target for dismiss: " + element.getAttribute("data-dismiss");
32 | }
33 |
34 | this.refersToProperty = element.getAttribute("data-toggle-property") || "display";
35 | this.refersToValue = element.getAttribute("data-toggle-value") || "\\auto";
36 |
37 | this.defaultValue = this.getCurrentValue();
38 |
39 | element.addEventListener("click", () => { this.toggleValue() });
40 | }
41 |
42 | private getCurrentValue(): any {
43 | return toggleProperties[this.refersToProperty].getValue(this.refersToElement, this.refersToValue);
44 | }
45 |
46 | private toggleValue() {
47 | toggleProperties[this.refersToProperty].toggle(this.refersToElement, this.refersToValue, this.defaultValue);
48 | }
49 |
50 | static find(query: string) {
51 | const elements = document.querySelectorAll(query);
52 | let toggles = [];
53 | for (let i = 0; i < elements.length; i++) {
54 | toggles.push(new Toggle(elements[i] as HTMLElement));
55 | }
56 | return toggles;
57 | }
58 | };
59 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@codidact/co-design",
3 | "version": "0.12.9",
4 | "description": "Co-Design is the design and component framework for Codidact",
5 | "author": "luap42",
6 | "repository": {
7 | "type": "git",
8 | "url": "git+https://github.com/codidact/co-design.git"
9 | },
10 | "keywords": [
11 | "codidact"
12 | ],
13 | "license": "MIT",
14 | "bugs": {
15 | "url": "https://github.com/codidact/co-design/issues"
16 | },
17 | "homepage": "https://github.com/codidact/co-design#readme",
18 | "scripts": {
19 | "css_build": "sass src:dist --style=compressed",
20 | "js_build": "tsc-bundle tsconfig.json",
21 | "docs_build": "npx @11ty/eleventy",
22 | "watch:sass": "sass src:dist --style=compressed --watch",
23 | "watch:ts": "tsc-bundle tsconfig.json --watch",
24 | "watch:docs": "npx @11ty/eleventy --serve --incremental",
25 | "build": "npm run -s css_build && npm run -s js_build && npm run -s docs_build",
26 | "dev": "npm-run-all --parallel watch:sass watch:ts watch:docs"
27 | },
28 | "dependencies": {
29 | "sass": "^1.34.1"
30 | },
31 | "devDependencies": {
32 | "@11ty/eleventy": "^2.0.1",
33 | "npm-run-all": "^4.1.5",
34 | "typescript": "^3.9.9",
35 | "typescript-bundle": "^1.0.17"
36 | },
37 | "files": [
38 | "dist/",
39 | "js/",
40 | "assets/fonts/"
41 | ]
42 | }
43 |
--------------------------------------------------------------------------------
/src/_child.scss:
--------------------------------------------------------------------------------
1 | /* Child theme for Codesign. You can edit this file */
2 |
3 |
4 | /* Do not remove this mixin. You may, however, change its
5 | contents */
6 |
7 | @mixin childOverrides() {
8 |
9 | }
10 |
--------------------------------------------------------------------------------
/src/codidact.scss:
--------------------------------------------------------------------------------
1 | /*
2 | * Codidact Design (Co-Design)
3 | * ===========================
4 | *
5 | * This code is licensed under the terms of the MIT
6 | * license. You should have obtained a copy of it
7 | * with this source code. You should find it in the
8 | * file named "LICENSE" in the topmost folder.
9 | *
10 | */
11 |
12 | /* First apply overrides */
13 | @import "_child.scss";
14 |
15 | /* Then import common styles */
16 | @import "common/common.scss";
17 |
18 | /* Then import specific styles */
19 | @import "specific/specific.scss";
20 |
21 | @include childOverrides();
22 |
--------------------------------------------------------------------------------
/src/common/_badges.scss:
--------------------------------------------------------------------------------
1 | .badge.is-tag,
2 | .badge-tag {
3 | display: inline-block;
4 | font-size: $badge-tag-font-size;
5 | padding: $badge-tag-padding-y*$padding-unit $badge-tag-padding-x*$padding-unit;
6 | font-weight: $badge-tag-font-weight;
7 | color: $badge-tag-color;
8 | background-color: $badge-tag-background-color;
9 | border-radius: $badge-tag-border-radius;
10 |
11 | &.is-master-tag, /* DEPRECATED */
12 | &.is-filled {
13 | color: #ffffff;
14 | background-color: $badge-tag-master-background-color;
15 | }
16 |
17 | @each $name, $value in $badge-tag-alternative-colors {
18 | &.is-#{$name} {
19 | background-color: lighten($value, 25%);
20 | color: darken($value, 35%);
21 |
22 | &.is-master-tag, /* DEPRECATED */
23 | &.is-filled {
24 | background-color: darken($value, 20%);
25 | color: white;
26 | }
27 | }
28 | }
29 |
30 | &.is-small {
31 | padding: $badge-tag-padding-y*$padding-unit*0.5 $badge-tag-padding-x*$padding-unit*0.5;
32 | line-height: 1;
33 | }
34 | }
35 |
36 | a.badge.is-tag:hover,
37 | a.badge-tag:hover {
38 | text-decoration: none !important;
39 | background-color: darken($badge-tag-background-color, 5%);
40 |
41 | &.is-master-tag, /* DEPRECATED */
42 | &.is-filled {
43 | color: #ffffff;
44 | background-color: darken($badge-tag-master-background-color, 5%);
45 | }
46 |
47 | @each $name, $value in $badge-tag-alternative-colors {
48 | &.is-#{$name} {
49 | background-color: lighten($value, 20%);
50 |
51 | &.is-master-tag, /* DEPRECATED */
52 | &.is-filled {
53 | background-color: darken($value, 25%);
54 | color: white;
55 | }
56 | }
57 | }
58 | }
59 |
60 | .badge.is-award,
61 | .badge-award {
62 | display: inline-block;
63 | padding: $badge-award-padding-y*$padding-unit $badge-award-padding-x*$padding-unit;
64 | font-weight: $badge-award-font-weight;
65 | font-size: $badge-award-font-size;
66 | color: $badge-award-color;
67 | background-color: $badge-award-background-color;
68 | border: $badge-award-border-width solid $badge-award-border-color;
69 | border-radius: $badge-award-border-radius;
70 |
71 | .badge--icon {
72 | margin-right: $margin-unit;
73 | }
74 |
75 | &.is-gold .badge--icon {
76 | color: $badge-award-gold-color;
77 | }
78 |
79 | &.is-silver .badge--icon {
80 | color: $badge-award-silver-color;
81 | }
82 |
83 | &.is-bronze .badge--icon {
84 | color: $badge-award-bronze-color;
85 | }
86 |
87 | &:hover {
88 | text-decoration: none;
89 | }
90 | }
91 |
92 |
93 | .badge.is-user-role,
94 | .badge-user-role {
95 | display: inline-block;
96 | font-size: $badge-role-font-size;
97 | padding: $badge-role-padding-y*$padding-unit $badge-role-padding-x*$padding-unit;
98 | border-radius: $badge-role-border-radius;
99 | background-color: $badge-role-background-color;
100 | color: $badge-role-color;
101 | font-weight: $badge-role-font-weight;
102 |
103 | &.is-muted {
104 | background-color: $badge-role-muted-background-color;
105 | color: $badge-role-muted-color;
106 | }
107 | }
108 |
109 | .badge.is-user-trust-level,
110 | .badge-user-trust-level {
111 | display: inline-block;
112 | font-size: $badge-tl-font-size;
113 | min-width: $badge-tl-min-width;
114 | text-align: center;
115 | padding: $badge-tl-padding-y*$padding-unit $badge-tl-padding-x*$padding-unit;
116 | border-radius: $badge-tl-border-radius;
117 | background-color: $badge-tl-background-color;
118 | color: $badge-tl-color;
119 | font-weight: $badge-tl-font-weight;
120 |
121 | &.is-muted {
122 | background-color: $badge-tl-muted-background-color;
123 | color: $badge-tl-muted-color;
124 | }
125 | }
126 |
127 |
128 | .badge.is-status {
129 | background-color: rgba(0,0,0,0.2);
130 | color: inherit;
131 | display: inline-block;
132 | font-size: 0.8em;
133 | padding: 0.1em 0.3em;
134 | min-width: 1.5em;
135 | margin: 0 0.3em;
136 | border-radius: 4px;
137 | line-height: 1;
138 | text-align: center;
139 |
140 | &:empty {
141 | height: 0.75em;
142 | width: 0.75em;
143 | border-radius: 50%;
144 | min-width: 0;
145 | background-color: rgba(0,0,0,0.4);
146 | }
147 | }
--------------------------------------------------------------------------------
/src/common/_bar.scss:
--------------------------------------------------------------------------------
1 | .bar {
2 | position: fixed;
3 | left: 0;
4 | right: 0;
5 | bottom: 0;
6 | max-height: $bar-max-height;
7 | overflow: auto;
8 | background-color: $bar-background-color;
9 | border-top: $bar-border-width solid $bar-border-color;
10 |
11 | .bar--container {
12 | padding: $bar-padding * $padding-unit;
13 | }
14 |
15 | & > .button.is-close-button {
16 | position: absolute;
17 | font-size: 2*$close-button-font-size !important;
18 | right: 0.5rem;
19 | top: 1rem;
20 | line-height: 0.75;
21 | }
22 | }
--------------------------------------------------------------------------------
/src/common/_box.scss:
--------------------------------------------------------------------------------
1 | @each $i in (0, 1, 2, 4, 6, 8, 12, 16, 18, 24, 32, 36) {
2 | .has-padding-#{$i},
3 | .h-p-#{$i} { padding: $i * $padding-unit;}
4 | .has-margin-#{$i},
5 | .h-m-#{$i} { margin: $i * $margin-unit;}
6 | }
7 |
8 | @each $i in (0, 1, 2, 4, 6, 8, 12, 16, 18, 24, 32, 36) {
9 | .has-padding-top-#{$i},
10 | .h-p-t-#{$i} { padding-top: $i * $padding-unit; }
11 | .has-padding-right-#{$i},
12 | .h-p-r-#{$i} { padding-right: $i * $padding-unit; }
13 | .has-padding-bottom-#{$i},
14 | .h-p-b-#{$i} { padding-bottom: $i * $padding-unit; }
15 | .has-padding-left-#{$i},
16 | .h-p-l-#{$i} { padding-left: $i * $padding-unit; }
17 |
18 | .has-padding-vertical-#{$i},
19 | .h-p-v-#{$i} {
20 | padding-top: $i * $padding-unit;
21 | padding-bottom: $i * $padding-unit;
22 | }
23 | .has-padding-horizontal-#{$i},
24 | .h-p-h-#{$i} {
25 | padding-right: $i * $padding-unit;
26 | padding-left: $i * $padding-unit;
27 | }
28 |
29 | .has-margin-top-#{$i},
30 | .h-m-t-#{$i} { margin-top: $i * $margin-unit; }
31 | .has-margin-right-#{$i},
32 | .h-m-r-#{$i} { margin-right: $i * $margin-unit; }
33 | .has-margin-bottom-#{$i},
34 | .h-m-b-#{$i} { margin-bottom: $i * $margin-unit; }
35 | .has-margin-left-#{$i},
36 | .h-m-l-#{$i} { margin-left: $i * $margin-unit; }
37 |
38 | .has-margin-vertical-#{$i},
39 | .h-m-v-#{$i} {
40 | margin-top: $i * $margin-unit;
41 | margin-bottom: $i * $margin-unit;
42 | }
43 | .has-margin-horizontal-#{$i},
44 | .h-m-h-#{$i} {
45 | margin-right: $i * $margin-unit;
46 | margin-left: $i * $margin-unit;
47 | }
48 | }
49 |
50 | @each $i in (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10) {
51 | .has-border-width-#{$i},
52 | .h-bw-#{$i} { border-width: #{$i}px }
53 | }
54 | @each $i in (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10) {
55 | .has-border-top-width-#{$i},
56 | .h-bw-t-#{$i} { border-top-width: #{$i}px; }
57 | .has-border-right-width-#{$i},
58 | .h-bw-r-#{$i} { border-right-width: #{$i}px; }
59 | .has-border-bottom-width-#{$i},
60 | .h-bw-b-#{$i} { border-bottom-width: #{$i}px; }
61 | .has-border-left-width-#{$i},
62 | .h-bw-l-#{$i} { border-left-width: #{$i}px; }
63 | }
64 |
65 | @each $i in (solid, none, dotted, dashed, double) {
66 | .has-border-style-#{$i},
67 | .h-bs-#{$i} { border-style: #{$i}; }
68 | }
69 |
70 | @each $i in (solid, none, dotted, dashed, double) {
71 | .has-border-top-style-#{$i},
72 | .h-bs-t-#{$i} { border-top-style: #{$i}; }
73 | .has-border-right-style-#{$i},
74 | .h-bs-r-#{$i} { border-right-style: #{$i}; }
75 | .has-border-bottom-style-#{$i},
76 | .h-bs-b-#{$i} { border-bottom-style: #{$i}; }
77 | .has-border-left-style-#{$i},
78 | .h-bs-l-#{$i} { border-left-style: #{$i}; }
79 | }
80 |
81 | @each $i in (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10) {
82 | .has-border-radius-#{$i},
83 | .h-br-#{$i} { border-radius: #{$i}px }
84 | }
85 |
86 | @each $i in (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10) {
87 | .has-border-top-left-radius-#{$i},
88 | .h-br-tl-#{$i} { border-top-left-radius: #{$i}px; }
89 | .has-border-top-right-radius-#{$i},
90 | .h-br-tr-#{$i} { border-top-right-radius: #{$i}px; }
91 | .has-border-bottom-left-radius-#{$i},
92 | .h-br-bl-#{$i} { border-bottom-left-radius: #{$i}px; }
93 | .has-border-bottom-right-radius-#{$i},
94 | .h-br-br-#{$i} { border-bottom-right-radius: #{$i}px; }
95 | }
96 |
97 | @each $i in (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10) {
98 | .has-shadow-#{$i},
99 | .h-s-#{$i} {
100 | box-shadow: 0 #{1.5*$i}px #{2*$i}px -#{$i}px $box-shadow-color;
101 | }
102 | }
103 |
104 |
105 | .has-float-left, .h-f-l { float: left; }
106 | .has-float-right, .h-f-r { float: right; }
107 | .has-float-none, .h-f-n { float: none; }
108 | .has-clear-clear,
109 | .has-clear,
110 | .h-c { clear: both; }
111 |
112 | @each $i in (none, block, flex, inline-block, inline, inline-flex) {
113 | .has-display-#{$i},
114 | .h-d-#{$i} { display: #{$i} }
115 | }
116 | .hide, [hidden] {
117 | display: none !important;
118 | }
--------------------------------------------------------------------------------
/src/common/_colors.scss:
--------------------------------------------------------------------------------
1 | @each $name, $value in map-merge($secondary-colors, (primary: $primary-color, tertiary: lighten($tertiary-color, 10%))) {
2 | .has-color-#{$name},
3 | .h-c-#{$name} { color: $value; }
4 | .has-background-color-#{$name},
5 | .h-bg-#{$name} { background-color: $value; }
6 | .has-border-color-#{$name},
7 | .h-bc-#{$name} { border-color: $value; }
8 |
9 | @each $gk, $gp in $color-gradient-stops {
10 | @if $gp < 0 {
11 | .has-color-#{$name}-#{$gk},
12 | .h-c-#{$name}-#{$gk} { color: darken($value, -$gp); }
13 | .has-background-color-#{$name}-#{$gk},
14 | .h-bg-#{$name}-#{$gk} { background-color: darken($value, -$gp); }
15 | .has-border-color-#{$name}-#{$gk},
16 | .h-bc-#{$name}-#{$gk} { border-color: darken($value, -$gp); }
17 | } @else {
18 | .has-color-#{$name}-#{$gk},
19 | .h-c-#{$name}-#{$gk} { color: lighten($value, $gp); }
20 | .has-background-color-#{$name}-#{$gk},
21 | .h-bg-#{$name}-#{$gk} { background-color: lighten($value, $gp); }
22 | .has-border-color-#{$name}-#{$gk},
23 | .h-bc-#{$name}-#{$gk} { border-color: lighten($value, $gp); }
24 | }
25 | }
26 |
27 | }
28 |
29 | .has-color-white,
30 | .h-c-white { color: white; }
31 | .has-background-color-white,
32 | .h-bg-white { background-color: white; }
33 | .has-border-color-white,
34 | .h-bc-white { border-color: white; }
35 |
36 | .has-color-black,
37 | .h-c-black { color: black; }
38 | .has-background-color-black,
39 | .h-bg-black { background-color: black; }
40 | .has-border-color-black,
41 | .h-bc-black { border-color: black; }
42 |
--------------------------------------------------------------------------------
/src/common/_droppanel.scss:
--------------------------------------------------------------------------------
1 | .droppanel {
2 | border: $drop-border-width solid $drop-border-color;
3 | padding: $drop-padding * $padding-unit;
4 | border-radius: $drop-border-radius;
5 | max-width: $drop-max-width;
6 | width: 100%;
7 | box-shadow: $drop-shadow;
8 | position: absolute;
9 | display: none;
10 | background-color: $drop-background-color;
11 |
12 | &.is-active { display: block; }
13 |
14 | &.is-large {
15 | max-width: $drop-large-max-width;
16 | }
17 |
18 | &.is-wide {
19 | max-width: $drop-wide-max-width;
20 | }
21 |
22 | .droppanel--header {
23 | color: $drop-header-color;
24 | margin: $drop-header-margin*$margin-unit 0;
25 | font-variant: small-caps;
26 |
27 | &:first-child {
28 | margin-top: 0;
29 | }
30 | }
31 |
32 | .droppanel--menu {
33 | margin: 0 $padding-unit * -$drop-padding;
34 | display: flex;
35 | flex-direction: column;
36 |
37 | a {
38 | padding: $drop-menu-item-padding-y*$padding-unit $drop-menu-item-padding-x*$padding-unit;
39 | color: $drop-menu-item-color;
40 |
41 | &:hover, &:focus, &:active {
42 | background-color: $drop-menu-item-hover-background-color;
43 | color: $drop-menu-item-color;
44 | text-decoration: none;
45 | }
46 |
47 | &.is-active {
48 | background-color: $drop-menu-item-active-background-color;
49 | color: $drop-menu-item-active-color;
50 | }
51 | }
52 | }
53 | }
--------------------------------------------------------------------------------
/src/common/_fontface.scss:
--------------------------------------------------------------------------------
1 | /*
2 | * RED HAT DISPLAY
3 | */
4 |
5 | @font-face {
6 | font-family: 'Red Hat Display';
7 | font-style: italic;
8 | font-weight: 400;
9 | src: url("../assets/fonts/Red_Hat_Display/RedHatDisplay-Italic.ttf");
10 | }
11 |
12 | @font-face {
13 | font-family: 'Red Hat Display';
14 | font-style: italic;
15 | font-weight: 500;
16 | src: url("../assets/fonts/Red_Hat_Display/RedHatDisplay-MediumItalic.ttf");
17 | }
18 |
19 | @font-face {
20 | font-family: 'Red Hat Display';
21 | font-style: italic;
22 | font-weight: 700;
23 | src: url("../assets/fonts/Red_Hat_Display/RedHatDisplay-BoldItalic.ttf");
24 | }
25 |
26 | @font-face {
27 | font-family: 'Red Hat Display';
28 | font-style: italic;
29 | font-weight: 900;
30 | src: url("../assets/fonts/Red_Hat_Display/RedHatDisplay-BlackItalic.ttf");
31 | }
32 |
33 | @font-face {
34 | font-family: 'Red Hat Display';
35 | font-style: normal;
36 | font-weight: 400;
37 | src: url("../assets/fonts/Red_Hat_Display/RedHatDisplay-Regular.ttf");
38 | }
39 |
40 | @font-face {
41 | font-family: 'Red Hat Display';
42 | font-style: normal;
43 | font-weight: 500;
44 | src: url("../assets/fonts/Red_Hat_Display/RedHatDisplay-Medium.ttf");
45 | }
46 |
47 | @font-face {
48 | font-family: 'Red Hat Display';
49 | font-style: normal;
50 | font-weight: 700;
51 | src: url("../assets/fonts/Red_Hat_Display/RedHatDisplay-Bold.ttf");
52 | }
53 |
54 | @font-face {
55 | font-family: 'Red Hat Display';
56 | font-style: normal;
57 | font-weight: 900;
58 | src: url("../assets/fonts/Red_Hat_Display/RedHatDisplay-Black.ttf");
59 | }
60 |
61 |
62 | /*
63 | * ROBOTO
64 | */
65 |
66 | @font-face {
67 | font-family: 'Roboto';
68 | font-style: italic;
69 | font-weight: 400;
70 | font-display: swap;
71 | src: url("../assets/fonts/Roboto/Roboto-Italic.ttf");
72 | }
73 |
74 | @font-face {
75 | font-family: 'Roboto';
76 | font-style: italic;
77 | font-weight: 500;
78 | font-display: swap;
79 | src: url("../assets/fonts/Roboto/Roboto-MediumItalic.ttf");
80 | }
81 |
82 | @font-face {
83 | font-family: 'Roboto';
84 | font-style: italic;
85 | font-weight: 700;
86 | font-display: swap;
87 | src: url("../assets/fonts/Roboto/Roboto-BoldItalic.ttf");
88 | }
89 |
90 | @font-face {
91 | font-family: 'Roboto';
92 | font-style: italic;
93 | font-weight: 900;
94 | font-display: swap;
95 | src: url("../assets/fonts/Roboto/Roboto-BlackItalic.ttf");
96 | }
97 |
98 |
99 | @font-face {
100 | font-family: 'Roboto';
101 | font-style: normal;
102 | font-weight: 400;
103 | font-display: swap;
104 | src: url("../assets/fonts/Roboto/Roboto-Regular.ttf");
105 | }
106 |
107 | @font-face {
108 | font-family: 'Roboto';
109 | font-style: normal;
110 | font-weight: 500;
111 | font-display: swap;
112 | src: url("../assets/fonts/Roboto/Roboto-Medium.ttf");
113 | }
114 |
115 | @font-face {
116 | font-family: 'Roboto';
117 | font-style: normal;
118 | font-weight: 700;
119 | font-display: swap;
120 | src: url("../assets/fonts/Roboto/Roboto-Bold.ttf");
121 | }
122 |
123 | @font-face {
124 | font-family: 'Roboto';
125 | font-style: normal;
126 | font-weight: 900;
127 | font-display: swap;
128 | src: url("../assets/fonts/Roboto/Roboto-Black.ttf");
129 | }
--------------------------------------------------------------------------------
/src/common/_footer.scss:
--------------------------------------------------------------------------------
1 | .footer {
2 | padding: $footer-padding * $padding-unit;
3 | border-top: $footer-top-border-width solid $footer-border-color;
4 | color: $footer-color;
5 | font-family: $font-stack-brand;
6 |
7 | margin-top: $footer-top-margin * $margin-unit;
8 |
9 | &.is-inverted {
10 | border-top: none;
11 | background-color: $footer-background-color;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/common/_form.scss:
--------------------------------------------------------------------------------
1 | label.form-element {
2 | cursor: pointer;
3 |
4 | display: block;
5 | margin: $label-margin-y*$margin-unit $label-margin-x*$margin-unit;
6 | @if ($label-smaller-margin-bottom < 1) {
7 | margin-bottom: $label-margin-y*$margin-unit*$label-smaller-margin-bottom;
8 | }
9 |
10 | font-size: $label-font-size;
11 | font-weight: $label-font-weight;
12 | color: $label-color;
13 | }
14 |
15 | .form-caption {
16 | color: $form-caption-color;
17 | font-size: $form-caption-font-size;
18 | margin-top: $form-caption-margin-top*$margin-unit;
19 | margin-bottom: $form-caption-margin-bottom*$margin-unit;
20 | }
21 |
22 | input.form-element {
23 | font: inherit;
24 | font-weight: $input-font-weight;
25 |
26 | padding: $input-padding*$padding-unit;
27 | margin: $input-margin-y*$margin-unit $input-margin-x*$margin-unit;
28 |
29 | border: $input-border-width solid $input-border-color;
30 | background-color: $input-background-color;
31 | border-radius: $input-border-radius;
32 |
33 | display: block;
34 | width: 100%;
35 |
36 | &:focus {
37 | border-color: $input-active-border-color;
38 | }
39 |
40 | &.is-danger {
41 | border-color: $input-danger-border-color;
42 | background-color: $input-danger-background-color;
43 | }
44 | }
45 |
46 | textarea.form-element {
47 | font: inherit;
48 | font-weight: $input-font-weight;
49 |
50 | padding: $input-padding*$padding-unit;
51 | margin: $input-margin-y*$margin-unit $input-margin-x*$margin-unit;
52 |
53 | border: $input-border-width solid $input-border-color;
54 | background-color: $input-background-color;
55 | border-radius: $input-border-radius;
56 |
57 | resize: $textarea-resize;
58 |
59 | display: block;
60 | width: 100%;
61 | min-height: $textarea-min-height;
62 |
63 | &:focus {
64 | border-color: $input-active-border-color;
65 | }
66 |
67 | &.is-danger {
68 | border-color: $input-danger-border-color;
69 | background-color: $input-danger-background-color;
70 | }
71 |
72 | &.is-small { min-height: $textarea-small-min-height; }
73 | &.is-large { min-height: $textarea-large-min-height; }
74 | }
75 |
76 |
77 | input[type="radio"].form-radio-element,
78 | input[type="checkbox"].form-checkbox-element {
79 | margin: $padding-unit;
80 | display: inline-block;
81 | cursor: pointer;
82 | }
83 |
84 |
85 | select.form-element {
86 | font: inherit;
87 | font-weight: $input-font-weight;
88 |
89 | padding: $input-padding*$padding-unit;
90 | margin: $input-margin-y*$margin-unit $input-margin-x*$margin-unit;
91 |
92 | cursor: pointer;
93 |
94 | border: $input-border-width solid $input-border-color;
95 | background-color: $input-background-color;
96 | border-radius: $input-border-radius;
97 |
98 | display: block;
99 | width: 100%;
100 |
101 | option {
102 | font: inherit;
103 | }
104 |
105 | &:focus {
106 | border-color: $input-active-border-color;
107 | }
108 |
109 | &.is-danger {
110 | border-color: $input-danger-border-color;
111 | background-color: $input-danger-background-color;
112 | }
113 | }
114 |
115 | select.form-element[multiple] {
116 | font: inherit;
117 | font-weight: $input-font-weight;
118 |
119 | padding: $input-padding*$padding-unit*0.5;
120 | margin: $input-margin-y*$margin-unit $input-margin-x*$margin-unit;
121 |
122 | cursor: inherit;
123 |
124 | border: $input-border-width solid $input-border-color;
125 | background-color: $input-background-color;
126 | border-radius: $input-border-radius;
127 |
128 | display: block;
129 | width: 100%;
130 |
131 | option {
132 | font: inherit;
133 | padding: $input-padding*$padding-unit*0.5;
134 | cursor: pointer;
135 | border-radius: $input-border-radius;
136 | }
137 |
138 | &:focus {
139 | border-color: $input-active-border-color;
140 | }
141 |
142 | &.is-danger {
143 | border-color: $input-danger-border-color;
144 | background-color: $input-danger-background-color;
145 | }
146 | }
--------------------------------------------------------------------------------
/src/common/_header.scss:
--------------------------------------------------------------------------------
1 | .header {
2 | padding: $padding-unit * $header-padding;
3 | margin-bottom: $margin-unit * $header-bottom-margin;
4 | font-family: $font-stack-brand;
5 |
6 | background: $header-background;
7 | color: $header-color;
8 | box-shadow: $header-shadow;
9 |
10 | font-weight: $header-font-weight;
11 |
12 | a:link, a:visited {
13 | color: inherit;
14 | display: inline-block;
15 | padding: $header-link-padding-y*$padding-unit $header-link-padding-x*$padding-unit;
16 | text-decoration: none !important;
17 | transition: $default-transition;
18 |
19 | &:hover, &:active {
20 | color: inherit;
21 | box-shadow: $header-link-hover-shadow;
22 | text-decoration: none;
23 | }
24 | }
25 |
26 | .header--container {
27 | display: flex;
28 | align-items: flex-end;
29 | padding: 0;
30 | }
31 |
32 | .header--brand {
33 | color: inherit;
34 | display: flex;
35 | flex-direction: column;
36 | align-items: flex-start;
37 |
38 | .header--instance-name {
39 | font-size: $header-brand-instance-font-size;
40 | }
41 |
42 | .header--site-name {
43 | font-size: $header-brand-site-font-size;
44 | }
45 |
46 | & + .header--menu {
47 | margin-left: $header-brand-menu-inner-margin * $margin-unit;
48 | }
49 | }
50 |
51 | .header--menu {
52 | flex-grow: 1;
53 | display: flex;
54 | justify-content: flex-end;
55 | align-items: center;
56 | min-height: $header-menu-min-height;
57 | flex-wrap: wrap;
58 |
59 | .header--separator { flex-grow: 1; }
60 |
61 | .header--item {
62 | padding: $header-item-padding-y*$padding-unit $header-item-padding-x*$padding-unit;
63 | margin: $header-item-margin-y*$margin-unit $header-item-margin-x*$margin-unit;
64 | cursor: pointer;
65 | font: inherit;
66 | color: $header-item-color;
67 | background-color: $header-item-background-color;
68 | border: none;
69 | display: flex;
70 | align-items: center;
71 | transition: $default-transition;
72 | position: relative;
73 | text-decoration: none !important;
74 |
75 | &:hover, &.is-active {
76 | color: $header-item-active-color;
77 | background-color: $header-item-active-background-color;
78 | }
79 |
80 | &.is-mobile-menu { display: none; }
81 |
82 | .header--alert {
83 | background-color: $header-alert-background-color;
84 | color: $header-alert-color;
85 | font-size: $header-alert-font-size;
86 | min-width: 1.5em;
87 | height: 1.5em;
88 | padding: $header-alert-padding-y*$padding-unit $header-alert-padding-x*$padding-unit;
89 | display: inline-block;
90 | border-radius: $header-alert-border-radius;
91 | text-align: center;
92 | margin: $header-alert-margin-y*$margin-unit $header-alert-margin-x*$margin-unit;
93 | }
94 |
95 | &.is-complex .header--alert {
96 | position: absolute;
97 | top: $header-alert-complex-top;
98 | left: $header-alert-complex-left;
99 | }
100 |
101 | .header--trust-level {
102 | color: $header-tl-color;
103 | font-size: $header-tl-font-size;
104 | opacity: $header-tl-opacity;
105 | text-shadow: $header-tl-small-outline-shadow;
106 | min-width: 1.5em;
107 | height: 1.5em;
108 | padding: $header-tl-padding * $padding-unit;
109 | display: inline-block;
110 | text-align: center;
111 | margin: $header-tl-margin-y*$margin-unit $header-tl-margin-x*$margin-unit;
112 | position: absolute;
113 | bottom: $header-tl-bottom;
114 | right: $header-tl-right;
115 | }
116 |
117 | .header--item-icon,
118 | .header--item-image {
119 | height: $header-icon-or-image-height;
120 | width: $header-icon-or-image-width;
121 | }
122 |
123 | .header--menu-bars {
124 | display: flex;
125 | flex-direction: column;
126 | height: $header-icon-or-image-height;
127 | width: $header-icon-or-image-width;
128 | justify-content: center;
129 | align-items: center;
130 |
131 | span {
132 | width: $header-bars-width;
133 | height: $header-bars-height;
134 | margin: $header-bars-margin-y-raw 0;
135 | background-color: $header-bars-color;
136 | transition: $default-transition;
137 | }
138 |
139 | }
140 | &:hover, &.is-active {
141 | .header--menu-bars span { background-color: $header-bars-active-color; }
142 | }
143 | }
144 | }
145 | }
146 |
147 |
148 | @media all and (max-width: $header-breakpoint) {
149 | .header {
150 | .header--brand {
151 | .header--site-name {
152 | font-size: $header-brand-site-small-font-size;
153 | }
154 | }
155 | .header--menu { flex-shrink: 0; }
156 | .header--menu .header--item {
157 | display: none;
158 |
159 | &.is-mobile-menu,
160 | &.is-visible-on-mobile {
161 | display: flex;
162 | }
163 | }
164 | }
165 | }
166 |
167 | .header.is-dark {
168 | color: $header-color__dark;
169 | box-shadow: $header-shadow__dark;
170 |
171 | a:link, a:visited {
172 | &:hover, &:active {
173 | box-shadow: $header-link-hover-shadow__dark;
174 | }
175 | }
176 |
177 | .header--menu {
178 | .header--item {
179 | color: $header-item-color__dark;
180 | background-color: $header-item-background-color__dark;
181 |
182 | &:hover, &.is-active {
183 | color: $header-item-active-color__dark;
184 | background-color: $header-item-active-background-color__dark;
185 | }
186 |
187 | .header--alert {
188 | background-color: $header-alert-background-color__dark;
189 | color: $header-alert-color__dark;
190 | }
191 |
192 | .header--menu-bars {
193 | span {
194 | margin: $header-bars-margin-y-raw 0;
195 | background-color: $header-bars-color__dark;
196 | }
197 |
198 | }
199 | &:hover, &.is-active {
200 | .header--menu-bars span { background-color: $header-bars-active-color__dark; }
201 | }
202 | }
203 | }
204 | }
205 |
206 | .header.is-small {
207 | padding: 0;
208 |
209 | .header--container {
210 | align-items: stretch;
211 |
212 | .header--menu {
213 | align-items: stretch;
214 | }
215 | }
216 | }
217 |
218 |
219 |
220 | .header-slide {
221 | position: absolute;
222 | top: $header-slide-default-top;
223 | right: $header-slide-default-right;
224 | width: 100%;
225 | max-width: $header-slide-max-width;
226 | background-color: $header-slide-background-color;
227 |
228 | padding: $header-slide-padding * $padding-unit;
229 |
230 | border: $header-slide-border;
231 | box-shadow: $header-slide-shadow;
232 |
233 | z-index: 100;
234 |
235 | display: none;
236 |
237 | &.is-active { display: block; }
238 | &.is-large {
239 | max-width: 2*$header-slide-max-width;
240 | }
241 |
242 | @media all and (max-width: $header-slide-max-width*1.1) {
243 | left: 0 !important;
244 | right: 0 !important;
245 | width: 100%;
246 | max-width: 100%;
247 | }
248 | }
249 |
--------------------------------------------------------------------------------
/src/common/_itemlists.scss:
--------------------------------------------------------------------------------
1 | .item-list {
2 | display: flex;
3 | flex-direction: column;
4 |
5 | align-items: stretch;
6 |
7 |
8 | .item-list--item {
9 | display: flex;
10 | align-items: center;
11 | border-bottom: $item-list-separator-width solid $item-list-separator-color;
12 |
13 | &.is-highlighted {
14 | background-color: $item-list-highlight;
15 | }
16 |
17 | .item-list--number-value {
18 | padding: $item-list-number-padding*$padding-unit;
19 | margin: $item-list-number-margin*$margin-unit;
20 |
21 | height: $item-list-value-height;
22 | width: $item-list-number-width;
23 |
24 | display: flex;
25 | flex-direction: column;
26 | align-items: center;
27 | justify-content: center;
28 |
29 | .item-list--number {
30 | font-size: $item-list-number-font-size;
31 | color: $item-list-number-font-color;
32 | }
33 |
34 | .item-list--number-label {
35 | font-size: $item-list-number-label-font-size;
36 | color: $item-list-number-label-color;
37 | }
38 | }
39 |
40 | .item-list--text-value {
41 | padding: $item-list-text-padding*$padding-unit;
42 | margin: $item-list-text-margin*$margin-unit;
43 |
44 | min-height: $item-list-value-height;
45 | width: $item-list-text-width;
46 |
47 | align-self: stretch;
48 |
49 | display: flex;
50 | flex-direction: column;
51 | align-items: center;
52 | justify-content: center;
53 |
54 | &.is-primary {
55 | align-items: flex-start;
56 | }
57 | }
58 |
59 | .item-list--image-value {
60 | padding: $item-list-image-padding*$padding-unit;
61 | margin: $item-list-image-margin*$margin-unit;
62 |
63 | height: $item-list-image-height;
64 | width: $item-list-image-width;
65 |
66 | img { border-radius: $item-list-image-border-radius; }
67 | }
68 |
69 | .is-primary {
70 | flex-grow: 1;
71 | }
72 | }
73 | }
74 |
75 |
76 | @media all and (max-width: $grid-small-to-medium-breakpoint) {
77 | .item-list .item-list--item {
78 | flex-wrap: wrap;
79 | justify-content: center;
80 |
81 | &>.is-primary {
82 | width: 100%;
83 | height: auto;
84 | margin: $item-list-primary-small-margin-y*$margin-unit $item-list-primary-small-margin-x*$margin-unit;
85 | }
86 |
87 | &>:not(.is-primary) {
88 | font-size: $item-list-not-primary-small-font-size;
89 | margin: $item-list-not-primary-small-margin-y*$margin-unit $item-list-not-primary-small-margin-x*$margin-unit;
90 |
91 | &.item-list--image-value {
92 | margin: $item-list-not-primary-image-small-margin-y*$margin-unit $item-list-not-primary-image-small-margin-x*$margin-unit;
93 | }
94 |
95 | &.item-list--text-value {
96 | height: auto;
97 | width: auto;
98 | }
99 |
100 | &.item-list--number-value {
101 | flex-direction: row;
102 | height: auto;
103 | width: auto;
104 |
105 |
106 | .item-list--number {
107 | font-size: $item-list-number-small-font-size;
108 | margin: $item-list-number-small-margin-y*$margin-unit $item-list-number-small-margin-x*$margin-unit;
109 | }
110 | }
111 | }
112 | }
113 | }
114 |
--------------------------------------------------------------------------------
/src/common/_layout.scss:
--------------------------------------------------------------------------------
1 | @use "sass:math";
2 |
3 | * { box-sizing: border-box; }
4 |
5 | html, body {
6 | margin: 0;
7 | padding: 0;
8 | }
9 |
10 | .container {
11 | max-width: $layout-container-width;
12 | margin: 0 auto;
13 | }
14 |
15 | .grid {
16 | display: flex;
17 | flex-wrap: wrap;
18 | margin: 0 math.div($grid-column-gap, -2);
19 | max-width: calc(100% - $grid-column-gap);
20 |
21 | &.is-nowrap {
22 | flex-wrap: nowrap;
23 | }
24 |
25 | .grid--cell {
26 | flex-grow: 0;
27 | flex-shrink: 0;
28 | padding: $grid-column-gap * 0.5;
29 |
30 | &.is-flexible {
31 | flex-grow: 1;
32 | flex-shrink: 1;
33 | }
34 |
35 | @for $i from 1 through $grid-column-count {
36 | &.is-#{$i} {
37 | width: math.div(100% * $i, $grid-column-count);
38 | }
39 | }
40 |
41 |
42 | @media all and (max-width: $grid-small-to-medium-breakpoint) {
43 | @for $i from 1 through $grid-column-count {
44 | &.is-#{$i}-sm {
45 | width: math.div(100% * $i, $grid-column-count);
46 | }
47 | }
48 | }
49 |
50 | @media all and (min-width: $grid-small-to-medium-breakpoint) and (max-width: $grid-medium-to-large-breakpoint) {
51 | @for $i from 1 through $grid-column-count {
52 | &.is-#{$i}-md {
53 | width: math.div(100% * $i, $grid-column-count);
54 | }
55 | }
56 | }
57 |
58 | @media all and (min-width: $grid-medium-to-large-breakpoint) {
59 | @for $i from 1 through $grid-column-count {
60 | &.is-#{$i}-lg {
61 | width: math.div(100% * $i, $grid-column-count);
62 | }
63 | }
64 | }
65 |
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/src/common/_modals.scss:
--------------------------------------------------------------------------------
1 | .modal {
2 | position: absolute;
3 | width: 100%;
4 | min-height: 100%;
5 | top: 0;
6 | left: 0;
7 | padding: $modal-outer-padding*$padding-unit;
8 |
9 | pointer-events: none;
10 |
11 | display: none;
12 |
13 | &.is-active { display: block; }
14 |
15 | &.is-with-backdrop {
16 | background-color: $modal-backdrop-background;
17 | position: fixed;
18 |
19 | height: 100%;
20 |
21 | pointer-events: all;
22 |
23 | .modal--container {
24 | box-shadow: $modal-shadow;
25 | max-height: 100%;
26 | }
27 | }
28 |
29 | .modal--container {
30 | margin: 0 auto;
31 | max-width: $modal-width;
32 | width: 100%;
33 |
34 | pointer-events: all;
35 |
36 | background-color: $modal-background-color;
37 | box-shadow: $modal-shadow;
38 | border: $modal-border-width solid $modal-border-color;
39 |
40 | display: flex;
41 | flex-direction: column;
42 |
43 |
44 | .modal--header {
45 | padding: $modal-header-padding * $padding-unit;
46 | font-size: $modal-header-font-size;
47 | border-bottom: $modal-border-width solid $modal-inner-border-color;
48 | font-weight: $modal-header-font-weight;
49 |
50 | .modal--header-link {
51 | float: right;
52 | font-size: $modal-header-link-font-size;
53 | padding: $padding-unit*$modal-header-link-padding-y $padding-unit*$modal-header-link-padding-x;
54 | }
55 |
56 | .modal--header-button {
57 | float: right;
58 | font-size: $modal-header-button-font-size;
59 | margin: 0;
60 | }
61 | }
62 |
63 | .modal--body {
64 | padding: $modal-body-padding * $padding-unit;
65 | max-height: $modal-body-overflow-height;
66 | overflow-y: auto;
67 | }
68 |
69 | .modal--footer {
70 | padding: $modal-footer-padding * $padding-unit;
71 | border-top: $modal-border-width solid $modal-inner-border-color;
72 | }
73 | }
74 |
75 | &.is-large .modal--container {
76 | max-width: $modal-large-width;
77 |
78 | .modal--body {
79 | max-height: $modal-large-body-overflow-height;
80 | }
81 | }
82 |
83 | &.is-small .modal--container {
84 | max-width: $modal-small-width;
85 |
86 | .modal--body {
87 | max-height: $modal-small-body-overflow-height;
88 | }
89 | }
90 |
91 | &.is-danger {
92 | .modal--header,
93 | .modal--container,
94 | .modal--footer {
95 | border-color: $modal-danger-border-color;
96 | }
97 |
98 | .modal--header {
99 | color: $modal-danger-header-color;
100 | background-color: $modal-danger-background-color;
101 | }
102 | }
103 | }
104 |
105 | @media all and (max-width: $grid-small-to-medium-breakpoint) {
106 | .modal {
107 | padding: 0;
108 | position: fixed;
109 | top: 0 !important;
110 |
111 | .modal--container {
112 | height: 100vh;
113 | }
114 | .modal--header,
115 | .modal--foter {
116 | flex-shrink: 0;
117 | }
118 | .modal--body {
119 | flex-grow: 1;
120 | overflow: auto;
121 | }
122 | }
123 | }
124 |
--------------------------------------------------------------------------------
/src/common/_nav.scss:
--------------------------------------------------------------------------------
1 | .tabs {
2 | padding: $tabs-padding*$padding-unit;
3 | display: flex;
4 | flex-wrap: wrap;
5 | font-family: $font-stack-brand;
6 |
7 | .tabs--item {
8 | display: block;
9 | font-weight: $tabs-font-weight;
10 | color: $tabs-color;
11 | text-decoration: none !important;
12 | padding: $tabs-item-padding-y*$padding-unit $tabs-item-padding-x*$padding-unit;
13 | margin: $tabs-item-margin*$padding-unit;
14 |
15 | &:hover {
16 | background-color: $tabs-hover-background-color;
17 | color: $tabs-hover-color;
18 | }
19 |
20 | &.is-active {
21 | background-color: $tabs-active-background-color;
22 | color: $tabs-active-color;
23 | }
24 | }
25 |
26 | &.is-classic-tabs {
27 | border-bottom: $tabs-classic-border-width solid $tabs-classic-border-color;
28 |
29 | .tabs--item {
30 | margin-bottom: 0;
31 | }
32 | }
33 | }
34 |
35 |
36 | .menu {
37 | padding: $menu-padding*$padding-unit;
38 | display: flex;
39 | flex-direction: column;
40 | font-family: $font-stack-brand;
41 |
42 | .menu--heading {
43 | display: block;
44 | font-weight: $menu-heading-font-weight;
45 | color: $menu-heading-color;
46 | text-decoration: none !important;
47 | padding: $menu-heading-padding-y*$padding-unit $menu-heading-padding-x*$padding-unit;
48 | margin: $menu-heading-margin-y*$padding-unit $menu-heading-margin-x*$padding-unit;
49 | border-radius: $menu-heading-border-radius;
50 | font-variant: small-caps;
51 | font-size: $menu-heading-font-size;
52 | }
53 | a.menu--heading {
54 | &:hover {
55 | background-color: $menu-hover-background-color;
56 | color: $menu-hover-color;
57 | }
58 |
59 | &.is-active {
60 | background-color: $menu-active-background-color;
61 | color: $menu-active-color;
62 | }
63 | }
64 |
65 | .menu--item {
66 | display: block;
67 | font-weight: $menu-font-weight;
68 | color: $menu-color;
69 | text-decoration: none !important;
70 | padding: $menu-item-padding-y*$padding-unit $menu-item-padding-x*$padding-unit;
71 | margin: $menu-item-margin-y*$padding-unit $menu-item-margin-x*$padding-unit;
72 | border-radius: $menu-item-border-radius;
73 | font-size: $menu-font-size;
74 |
75 | &:hover {
76 | background-color: $menu-hover-background-color;
77 | color: $menu-hover-color;
78 | }
79 |
80 | &.is-active {
81 | background-color: $menu-active-background-color;
82 | color: $menu-active-color;
83 | }
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/src/common/_notices.scss:
--------------------------------------------------------------------------------
1 | .notice {
2 | margin: $notice-margin-y*$margin-unit $notice-margin-x*$margin-unit;
3 | padding: $notice-padding * $padding-unit;
4 | border-radius: $notice-border-radius;
5 | border: $notice-border-width solid $notice-default-border-color;
6 | background-color: $notice-default-background-color;
7 |
8 | &.is-filled {
9 | border-color: transparent;
10 | color: white;
11 | background-color: $notice-default-filled-background-color;
12 | }
13 |
14 | @each $name, $color in (
15 | "warning": map-get($secondary-colors, "yellow"),
16 | "danger": darken(map-get($secondary-colors, "red"), 2.5%),
17 | "success": lighten(map-get($secondary-colors, "green"), 7.5%),
18 | "info": lighten(map-get($secondary-colors, "teal"), 5%),
19 | ) {
20 | &.is-#{$name} {
21 | border-color: lighten($color, 15%);
22 | background-color: lighten($color, 35%);
23 | }
24 | &.is-#{$name}.is-filled {
25 | border-color: transparent;
26 | background-color: darken($color, 25%);
27 | }
28 | }
29 |
30 | &.is-banner {
31 | border-left: none;
32 | border-right: none;
33 | margin: 0;
34 | border-radius: 0;
35 | }
36 |
37 | :first-child {
38 | margin-top: 0;
39 | }
40 |
41 | // Don't remove the margin for close buttons as first element
42 | .is-close-button:first-child {
43 | margin-top: -$margin-unit;
44 |
45 | // Remove margin then for second element
46 | & + * {
47 | margin-top: 0;
48 | }
49 | }
50 |
51 | :last-child {
52 | margin-bottom: 0;
53 | }
54 | }
55 |
56 | .header + .notice.is-banner {
57 | margin-top: $margin-unit * -$header-bottom-margin;
58 | margin-bottom: $margin-unit * $header-bottom-margin;
59 | }
60 |
--------------------------------------------------------------------------------
/src/common/_pagination.scss:
--------------------------------------------------------------------------------
1 | ul.pagination {
2 | display: flex;
3 | flex-wrap: wrap;
4 | margin: $pagination-margin-y*$margin-unit $pagination-margin-x*$margin-unit;
5 | padding: 0;
6 | list-style: none;
7 |
8 | li {
9 | display: block;
10 | margin: $pagination-item-margin-y*$margin-unit $margin-unit*$pagination-item-margin-x;
11 | padding: 0;
12 | border: $pagination-item-border-width solid $pagination-item-border-color;
13 | background-color: $pagination-item-background-color;
14 | box-shadow: $pagination-item-box-shadow;
15 | border-radius: $pagination-item-border-radius;
16 | font-weight: $pagination-item-font-weight;
17 |
18 | &.is-active {
19 | border-color: $pagination-item-active-border-color;
20 | background-color: $pagination-item-active-background-color;
21 | box-shadow: $pagination-item-active-box-shadow;
22 | color: $pagination-item-active-color;
23 | font-weight: $pagination-item-active-font-weight;
24 |
25 | a:hover {
26 | background-color: transparent;
27 | }
28 | }
29 |
30 | &.is-disabled {
31 | box-shadow: $pagination-item-hover-box-shadow;
32 | }
33 |
34 | span, a {
35 | padding: $pagination-item-padding-y*$padding-unit $pagination-item-padding-x*$padding-unit;
36 | display: block;
37 | color: inherit;
38 | }
39 |
40 | a:hover {
41 | background-color: $pagination-item-hover-background-color;
42 | color: inherit;
43 | }
44 | }
45 | }
--------------------------------------------------------------------------------
/src/common/_typography.scss:
--------------------------------------------------------------------------------
1 | html {
2 | font-family: $font-stack-primary;
3 | font-size: $font-size;
4 | }
5 |
6 | h1 {
7 | font-size: $font-size-h1;
8 | font-weight: bold;
9 | margin: $margin-h1;
10 | }
11 |
12 | h2 {
13 | font-size: $font-size-h2;
14 | font-weight: bold;
15 | margin: $margin-h2;
16 | }
17 |
18 | h3 {
19 | font-size: $font-size-h3;
20 | font-weight: bold;
21 | margin: $margin-h3;
22 | }
23 |
24 | h4 {
25 | font-size: $font-size-h4;
26 | font-weight: bold;
27 | margin: $margin-h4;
28 | }
29 |
30 | h5 {
31 | font-size: $font-size-h5;
32 | font-weight: bold;
33 | margin: $margin-h5;
34 | }
35 |
36 | h6 {
37 | font-size: $font-size-h6;
38 | font-weight: bold;
39 | margin: $margin-h6;
40 | }
41 |
42 | p {
43 | line-height: 1.5;
44 | margin: $margin-p;
45 | }
46 | p.is-lead,
47 | .is-lead p {
48 | font-size: $p-lead-font-size;
49 | color: $p-lead-color;
50 | }
51 |
52 | ul li, ol li {
53 | line-height: 1.5;
54 | }
55 |
56 | a:link, a:visited, .link {
57 | color: $link-color;
58 | text-decoration: none;
59 | transition: $default-transition;
60 | cursor: pointer;
61 |
62 | &:hover, &:active {
63 | color: darken($link-color, 20%);
64 | text-decoration: underline;
65 | }
66 |
67 | @each $key, $value in $secondary-colors {
68 | &.is-#{$key} {
69 | color: darken($value, 25%);
70 |
71 | &:hover, &:active {
72 | color: darken($value, 40%);
73 | }
74 | }
75 | }
76 |
77 | &.is-muted {
78 | color: darken($tertiary-color, 5%);
79 |
80 | &:hover {
81 | color: darken($tertiary-color, 25%);
82 | }
83 | }
84 |
85 | &.is-not-underlined:hover {
86 | text-decoration: none;
87 | }
88 |
89 | &.is-underlined {
90 | text-decoration: underline;
91 | }
92 | }
93 | .link {
94 | font-size: inherit;
95 | font-family: inherit;
96 | border: none;
97 | background-color: transparent;
98 | margin: 0;
99 | padding: 0;
100 | }
101 |
102 | code {
103 | display: inline;
104 | border: $code-border-width solid $code-border-color;
105 | border-radius: $code-border-radius;
106 | padding: $code-padding-y*$padding-unit $code-padding-x*$padding-unit;
107 |
108 | font-family: $font-stack-code;
109 | font-size: $code-font-size;
110 | }
111 |
112 | pre {
113 | display: block;
114 | border: $code-border-width solid $code-border-color;
115 | border-radius: $code-border-radius;
116 | padding: $code-block-padding * $padding-unit;
117 |
118 | font-family: $font-stack-code;
119 | font-size: $code-font-size;
120 | max-height: $code-block-max-height;
121 | overflow: auto;
122 |
123 | line-height: 1.5;
124 |
125 | code {
126 | display: block;
127 | border: none;
128 | padding: 0;
129 | font-size: 1em;
130 | }
131 | }
132 |
133 | blockquote {
134 | margin: $quote-margin-y*$margin-unit $quote-margin-x*$margin-unit;
135 | padding: $quote-padding-y*$padding-unit $quote-padding-x*$padding-unit;
136 | background-color: $quote-background-color;
137 | border: $quote-border-width solid $quote-border-color;
138 |
139 | border-radius: $quote-border-radius;
140 | border-bottom-left-radius: 0;
141 |
142 | h1, h2, h3, h4, h5, h6, p {
143 | &:first-child {
144 | margin-top: 0
145 | }
146 | &:last-child {
147 | margin-bottom: 0
148 | }
149 | }
150 | }
151 |
152 | ins, del {
153 | padding: $delta-padding-y*$padding-unit $delta-padding-x*$padding-unit;
154 | margin: $delta-margin-y*$margin-unit $delta-margin-x*$margin-unit;
155 | border-radius: $delta-border-radius;
156 | }
157 | ins {
158 | background-color: $delta-ins-background-color;
159 | text-decoration: underline;
160 | }
161 | del {
162 | background-color: $delta-del-background-color;
163 | text-decoration: line-through;
164 | }
165 |
166 |
167 | table.table {
168 | border-collapse: collapse;
169 | padding: $padding-unit;
170 | max-width: 100%;
171 |
172 | &.is-full-width {
173 | width: 100%;
174 | }
175 |
176 | th {
177 | border-bottom: $table-th-border-width solid $table-border-color;
178 | padding: $table-padding-y*$padding-unit $table-padding-x*$padding-unit;
179 | font-weight: $table-th-font-weight;
180 | text-align: left;
181 | }
182 |
183 | td {
184 | border-bottom: $table-td-border-width solid $table-border-color;
185 | padding: $table-padding-y*$padding-unit $table-padding-x*$padding-unit;
186 | text-align: left;
187 | }
188 |
189 | th, td {
190 | &:not(:last-child) {
191 | border-right: $table-td-border-width solid $table-border-color;
192 | }
193 | }
194 |
195 | &.is-compact {
196 | th, td {
197 | padding: $table-compact-padding-y*$padding-unit $table-compact-padding-x*$padding-unit;
198 | }
199 | }
200 |
201 | &.is-striped tr:nth-of-type(2n+1) td {
202 | background-color: $table-stripe-background-color;
203 | }
204 |
205 | &.is-with-hover tr:hover td {
206 | background-color: $table-hover-background-color;
207 | }
208 | }
209 |
210 | img {
211 | max-width: 100%;
212 | height: auto;
213 | align-self: flex-start;
214 | }
215 |
216 | details {
217 | padding: 2 * $padding-unit;
218 |
219 | summary {
220 | border-bottom: 1px solid lighten($tertiary-color, 30%);
221 | padding: 2 * $padding-unit 0;
222 | padding-left: 2em;
223 | cursor: pointer;
224 | margin: -2 * $padding-unit;
225 | appearance: none;
226 | -moz-appearance: none;
227 | position: relative;
228 | display: block;
229 | font-weight: 500;
230 |
231 | &::-webkit-details-marker { display: none; }
232 |
233 | &::before {
234 | content: '';
235 | height: 0.75em;
236 | width: 0.75em;
237 | display: block;
238 | position: absolute;
239 | top: 2.5 * $padding-unit;
240 | left: 1.5 * $padding-unit;
241 | border-radius: 0.125em;
242 | border-top: 4px solid lighten($tertiary-color, 20%);
243 | border-right: 4px solid lighten($tertiary-color, 20%);
244 | transform: rotate(45deg);
245 | transition: transform .1s ease;
246 | }
247 |
248 | h1, h2, h3, h4, h5, h6, p {
249 | margin: 0 auto;
250 | }
251 | }
252 |
253 | &[open] {
254 | summary {
255 | margin-bottom: 2 * $margin-unit;
256 | }
257 | & > summary::before {
258 | transform: rotate(135deg);
259 | left: 2 * $padding-unit;
260 | }
261 | }
262 | }
263 |
264 |
265 | @each $key, $value in $font-size-gradient {
266 | .has-font-size-#{$key},
267 | .h-fs-#{$key} {
268 | font-size: $value;
269 | }
270 | }
271 |
272 | .has-font-family-primary,
273 | .h-ff-primary { font-family: $font-stack-primary; }
274 | .has-font-family-brand,
275 | .h-ff-brand { font-family: $font-stack-brand; }
276 | .has-font-family-code,
277 | .h-ff-code { font-family: $font-stack-code; }
278 |
279 | .has-font-weight-normal,
280 | .h-fw-normal { font-weight: 400; }
281 | .has-font-weight-medium,
282 | .h-fw-medium { font-weight: 500; }
283 | .has-font-weight-bold,
284 | .h-fw-bold { font-weight: 700; }
285 | .has-font-weight-black,
286 | .h-fw-black { font-weight: 900; }
287 |
288 | .has-font-style-normal,
289 | .h-fst-normal { font-style: normal; }
290 | .has-font-style-italic,
291 | .h-fst-italic { font-style: italic; }
292 |
293 | .has-text-align-left,
294 | .h-ta-left { text-align: left; }
295 | .has-text-align-center,
296 | .h-ta-center { text-align: center; }
297 | .has-text-align-right,
298 | .h-ta-right { text-align: right; }
299 | .has-text-align-justify,
300 | .h-ta-justify { text-align: justify; }
--------------------------------------------------------------------------------
/src/common/_widgets.scss:
--------------------------------------------------------------------------------
1 | @use "sass:math";
2 |
3 | .widget {
4 | border: $widget-border-width solid $widget-border-color;
5 | border-radius: $widet-border-radius;
6 | box-shadow: $widget-shadow;
7 | margin: $widget-margin-y*$margin-unit $widget-margin-x*$margin-unit;
8 | background-color: $widget-background-color;
9 |
10 | .widget--header {
11 | padding: $widget-header-padding * $padding-unit;
12 | font-size: $widget-header-font-size;
13 | font-weight: $widget-header-font-weight;
14 | border-bottom: $widget-border-width solid $widget-border-color;
15 |
16 | &.is-complex {
17 | font-size: 1em;
18 | }
19 |
20 | .widget--header-link {
21 | float: right;
22 | font-size: $widget-header-link-font-size;
23 | padding: $padding-unit*$widget-header-link-padding-y $padding-unit*$widget-header-link-padding-x;
24 | }
25 | .widget--header-button {
26 | float: right;
27 | font-size: $widget-header-button-font-size;
28 | position: relative;
29 | top: math.div(-$widget-header-padding, 1.8)*$padding-unit;
30 | }
31 | }
32 |
33 | .widget--body {
34 | padding: $widget-body-padding * $padding-unit;
35 |
36 | & + .widget--body {
37 | border-top: $widget-border-width solid $widget-border-color;
38 | }
39 | }
40 |
41 | .widget--footer {
42 | padding: $widget-footer-padding * $padding-unit;
43 | border-top: $widget-border-width solid $widget-border-color;
44 | }
45 | }
46 |
47 | @each $name, $color in (
48 | "yellow": map-get($secondary-colors, "yellow"),
49 | "red": darken(map-get($secondary-colors, "red"), 2.5%),
50 | "green": lighten(map-get($secondary-colors, "green"), 10%),
51 | "teal": lighten(map-get($secondary-colors, "teal"), 7.5%),
52 | "tertiary": lighten($tertiary-color, 7.5%)
53 | ) {
54 | .widget.is-#{$name} {
55 | border-color: lighten($color, $widget-border-color-lighten);
56 | background-color: lighten($color, $widget-background-color-lighten);
57 |
58 | .widget--header {
59 | background-color: lighten($color, $widget-background-color-hf-lighten);
60 | border-color: lighten($color, $widget-border-color-lighten);
61 | }
62 |
63 | .widget--body + .widget--body {
64 | border-color: lighten($color, $widget-border-color-lighten);
65 | }
66 |
67 | .widget--footer {
68 | background-color: lighten($color, $widget-background-color-hf-lighten);
69 | border-color: lighten($color, $widget-border-color-lighten);
70 | }
71 | }
72 | }
--------------------------------------------------------------------------------
/src/common/common.scss:
--------------------------------------------------------------------------------
1 | /*
2 | * Codidact Design (Co-Design)
3 | * ===========================
4 | * Module: COMMON
5 | *
6 | * This code is licensed under the terms of the MIT
7 | * license. You should have obtained a copy of it
8 | * with this source code. You should find it in the
9 | * file named "LICENSE" in the topmost folder.
10 | *
11 | */
12 |
13 | /* First import configuration stylesheet */
14 | @import "_config.scss";
15 |
16 | /* Then include components */
17 | @import "_header.scss";
18 | @import "_buttons.scss";
19 | @import "_nav.scss";
20 | @import "_form.scss";
21 | @import "_notices.scss";
22 | @import "_widgets.scss";
23 | @import "_modals.scss";
24 | @import "_itemlists.scss";
25 | @import "_badges.scss";
26 | @import "_footer.scss";
27 | @import "_pagination.scss";
28 | @import "_bar.scss";
29 | @import "_droppanel.scss";
30 |
31 | /* Then include basic design elements */
32 | @import "_fontface.scss";
33 | @import "_typography.scss";
34 | @import "_layout.scss";
35 |
36 | /* Then include atomic design definitions */
37 | @import "_box.scss";
38 | @import "_colors.scss";
--------------------------------------------------------------------------------
/src/specific/_category-header.scss:
--------------------------------------------------------------------------------
1 | @mixin category-header-content ($color) {
2 | background-color: lighten($color, $ch-container-lighter);
3 | font-family: $font-stack-brand;
4 |
5 | .category-header--tabs {
6 | background-color: lighten($color, $ch-tabs-lighter);
7 |
8 | .category-header--tabs-container {
9 | display: flex;
10 | width: 100%;
11 |
12 | @media screen and (max-width: $grid-medium-to-large-breakpoint) {
13 | overflow-x: scroll;
14 | }
15 | }
16 |
17 | .category-header--tab {
18 | padding: $ch-tab-padding-y*$padding-unit $ch-tab-padding-x*$padding-unit;
19 | color: $ch-tab-color;
20 | display: block;
21 | font-weight: $ch-tab-font-weight;
22 | font-size: $ch-tab-font-size;
23 | cursor: pointer;
24 |
25 | transition: $default-transition;
26 |
27 | &:hover {
28 | background-color: lighten($color, $ch-tabs-lighter-hover);
29 | text-decoration: none;
30 | }
31 |
32 | &.is-active {
33 | background-color: lighten($color, $ch-container-lighter);
34 | text-decoration: none;
35 | color: $ch-container-color;
36 | }
37 | }
38 | }
39 | .category-header--container {
40 | padding: $ch-container-padding-y*$padding-unit $ch-container-padding-x*$padding-unit;
41 | color: $ch-container-color;
42 | display: flex;
43 | align-items: center;
44 |
45 | .category-header--name {
46 | font-size: $ch-category-name-font-size;
47 | font-weight: $ch-category-name-font-weight;
48 | }
49 |
50 | .category-header--nav {
51 | display: flex;
52 | flex-grow: 1;
53 | padding: $ch-nav-padding-y*$padding-unit $ch-nav-padding-x*$padding-unit;
54 | align-items: center;
55 |
56 | .category-header--nav-separator {
57 | flex-grow: 1;
58 | }
59 |
60 | .category-header--nav-item {
61 | padding: $ch-nav-item-padding-y*$padding-unit $ch-nav-item-padding-x*$padding-unit;
62 | margin: $ch-nav-item-margin-y*$margin-unit $ch-nav-item-margin-x*$margin-unit;
63 | color: inherit;
64 | display: block;
65 | font-weight: $ch-nav-item-font-weight;
66 | font-size: $ch-nav-item-font-size;
67 | cursor: pointer;
68 |
69 | border-radius: $ch-nav-item-border-radius;
70 |
71 | &:hover {
72 | background-color: darken($color, $ch-nav-item-darken-hover);
73 | text-decoration: none;
74 | }
75 |
76 | &.is-active {
77 | background-color: darken($color, $ch-nav-item-darken-active);
78 | text-decoration: none;
79 | }
80 |
81 | &.is-button {
82 | background-color: darken($color, $ch-nav-button-darken);
83 | padding: $ch-nav-button-padding-y*$padding-unit $ch-nav-button-padding-x*$padding-unit;
84 | &:hover {
85 | background-color: darken($color, $ch-nav-button-darken-hover);
86 | text-decoration: none;
87 | }
88 |
89 | &:active {
90 | background-color: darken($color, $ch-nav-button-darken-active);
91 | }
92 | }
93 | }
94 | }
95 | }
96 | }
97 |
98 | .category-header {
99 | @each $key, $value in $application-colors {
100 | &.is-#{$key} {
101 | @include category-header-content($value);
102 | }
103 | }
104 | }
105 |
106 | .header + .category-header {
107 | margin-top: $margin-unit * -$header-bottom-margin;
108 | margin-bottom: $margin-unit * $header-bottom-margin;
109 | }
110 |
111 |
112 | @media all and (max-width: $ch-mobile-breakpoint) {
113 | .category-header {
114 | .category-header--name { display: none; }
115 | }
116 | }
--------------------------------------------------------------------------------
/src/specific/_config.scss:
--------------------------------------------------------------------------------
1 | @import "../common/_config.scss";
2 |
3 | $application-colors: (
4 | "turquoise": darken(#61c4a6, 15%),
5 | "green": #5b995a,
6 | "blue": #3498db,
7 | "darkblue": #4366de,
8 | "purple": darken(#b86ad9, 15%),
9 | "bluegray": lighten(#34495e, 25%),
10 | "gray": darken(#7f8c8d, 10%),
11 | "yellow": darken(#eed04b, 25%),
12 | "orange": darken(#e67e22, 10%),
13 | "pink": darken(#f293cd, 30%),
14 | "red": #c0392b
15 | ) !default;
16 |
17 | /* Category header */
18 | $ch-tabs-lighter: 30% !default;
19 | $ch-tabs-lighter-hover: 20% !default;
20 | $ch-tab-padding-y: 1.5 !default;
21 | $ch-tab-padding-x: 4 !default;
22 | $ch-tab-color: #000 !default;
23 | $ch-tab-font-size: 1rem !default;
24 | $ch-tab-font-weight: 500 !default;
25 |
26 | $ch-container-lighter: 0% !default;
27 | $ch-container-color: white !default;
28 | $ch-container-padding-y: 1.5 !default;
29 | $ch-container-padding-x: 2 !default;
30 |
31 | $ch-category-name-font-size: 1.75rem !default;
32 | $ch-category-name-font-weight: 700 !default;
33 |
34 | $ch-nav-padding-y: 1 !default;
35 | $ch-nav-padding-x: 2 !default;
36 |
37 | $ch-nav-item-padding-y: 1 !default;
38 | $ch-nav-item-padding-x: 2 !default;
39 | $ch-nav-item-margin-y: 0 !default;
40 | $ch-nav-item-margin-x: 1.5 !default;
41 | $ch-nav-item-darken-hover: 5% !default;
42 | $ch-nav-item-darken-active: 10% !default;
43 | $ch-nav-item-font-size: 1rem !default;
44 | $ch-nav-item-font-weight: 500 !default;
45 | $ch-nav-item-border-radius: 3px !default;
46 |
47 |
48 | $ch-nav-button-darken: 10% !default;
49 | $ch-nav-button-padding-y: 1.5 !default;
50 | $ch-nav-button-padding-x: 2.5 !default;
51 | $ch-nav-button-darken-hover: 20% !default;
52 | $ch-nav-button-darken-active: 30% !default;
53 |
54 | $ch-mobile-breakpoint: 850px !default;
55 |
56 | /* Diff */
57 | $diff-padding: 4 !default;
58 | $diff-margin: 0.5 !default;
59 | $diff-element-border-radius: 3px !default;
60 |
61 | $diff-added-background-color: lighten(map-get($secondary-colors, "green"), 45%) !default;
62 | $diff-removed-background-color: lighten(map-get($secondary-colors, "red"), 30%) !default;
63 | $diff-changed-background-color: lighten($tertiary-color, 42.5%) !default;
64 |
65 | /* ToC */
66 | $toc-header-font-weight: 500;
67 | $toc-header-top-margin: 2;
68 | $toc-header-active-background-color: lighten($tertiary-color, 35%);
69 | $toc-header-active-color: inherit;
70 | $toc-header-padding-x: 2;
71 | $toc-header-padding-y: 1;
72 |
73 | $toc-outer-border-width: 2px;
74 | $toc-inner-border-width: 1px;
75 | $toc-border-color: lighten($tertiary-color, 35%);
76 |
77 | $toc-entry-font-size: 0.9em;
78 | $toc-entry-padding: 1;
79 | $toc-entry-hover-background-color: lighten($tertiary-color, 40%);
80 |
81 | $toc-icon-width: 2rem;
82 |
83 | $toc-badge-min-width: 3rem;
84 | $toc-badge-padding: 0.5;
85 |
86 | $toc-full-padding-y: 0;
87 | $toc-full-padding-x: 2;
88 |
89 | /* Meters */
90 | $meter-height: 0.75rem !default;
91 | $meter-max-width: 20rem !default;
92 |
93 | $meter-progress-border-width: 1px;
94 | $meter-progress-color: darken($primary-color, 35%);
95 | $meter-progress-border-color: darken($primary-color, 25%);
96 | $meter-progress-border-radius: 0.25rem;
97 | $meter-progress-inner-color: lighten($primary-color, 25%);
98 |
99 | $meter-question-score-border-radius: 3px;
100 | $meter-question-score-dash-width: 2px;
101 | $meter-question-score-outer-color: lighten($tertiary-color, 35%);
102 | $meter-question-score-dash-color: darken($tertiary-color, 30%);
103 | $meter-question-score-negative-color: lighten(map-get($secondary-colors, "red"), 5%);
104 | $meter-question-score-positive-color: darken(map-get($secondary-colors, "green"), 10%);
105 |
106 | /* Tools */
107 | $tools-padding-y: 2;
108 | $tools-padding-x: 2;
109 |
110 | $tools-item-font-size: 1em;
111 | $tools-item-font-weight: 400;
112 | $tools-item-padding-y: 2;
113 | $tools-item-padding-x: 2;
114 | $tools-item-margin-y: 0.125;
115 | $tools-item-margin-x: 0.6;
116 |
117 | $tools-item-background-color: transparent;
118 | $tools-item-color: darken($tertiary-color, 5%);
119 | $tools-item-active-background-color: lighten($tertiary-color, 35%);
120 | $tools-item-active-color: darken($tertiary-color, 25%);
121 | $tools-item-active-inner-shadow: 0 2px 4px -2px darken($tertiary-color, 5%);
122 |
123 | $tools-item-danger-background-color: transparent;
124 | $tools-item-danger-color: darken($tertiary-color, 5%);
125 | $tools-item-danger-hover-background-color: darken(map-get($secondary-colors, "red"), 10%);
126 | $tools-item-danger-active-background-color: darken(map-get($secondary-colors, "red"), 20%);
127 | $tools-item-danger-active-color: white;
128 | $tools-item-danger-active-inner-shadow: 0 2px 4px -2px darken(map-get($secondary-colors, "red"), 45%);
129 |
130 | $tools-item-danger-filled-background-color: map-get($secondary-colors, "red");
131 | $tools-item-danger-filled-color: white;
132 | $tools-item-danger-filled-hover-background-color: darken(map-get($secondary-colors, "red"), 20%);
133 | $tools-item-danger-filled-active-background-color: darken(map-get($secondary-colors, "red"), 30%);
134 | $tools-item-danger-filled-active-color: white;
135 | $tools-item-danger-filled-active-inner-shadow: 0 2px 4px -2px darken(map-get($secondary-colors, "red"), 45%);
--------------------------------------------------------------------------------
/src/specific/_diff.scss:
--------------------------------------------------------------------------------
1 | .diff {
2 | .diff-section {
3 | display: flex;
4 |
5 | .diff-old,
6 | .diff-new,
7 | .diff-inline {
8 | padding: $diff-padding*$padding-unit;
9 | margin: $diff-margin*$margin-unit;
10 | border-radius: $diff-element-border-radius;
11 | width: 0;
12 | flex-grow: 1;
13 |
14 | &:first-child {
15 | margin-left: 0;
16 | }
17 |
18 | &:last-child {
19 | margin-right: 0;
20 | }
21 | }
22 |
23 | .diff-old.is-changed {
24 | background-color: $diff-removed-background-color;
25 | }
26 |
27 | .diff-new.is-changed {
28 | background-color: $diff-added-background-color;
29 | }
30 |
31 | .diff-inline.is-changed {
32 | background-color: $diff-changed-background-color;
33 | }
34 | }
35 |
36 | .diff-load-more-button {
37 | display: block;
38 | width: 100%;
39 | margin: 0;
40 | border-radius: $diff-element-border-radius;
41 | }
42 | }
--------------------------------------------------------------------------------
/src/specific/_meter.scss:
--------------------------------------------------------------------------------
1 | .meter {
2 | height: $meter-height;
3 | width: 100%;
4 | display: flex;
5 | align-items: stretch;
6 | justify-content: flex-start;
7 | position: relative;
8 |
9 | .meter--bar {
10 | width: 0;
11 | font-size: 0;
12 | line-height: 0;
13 | color: transparent;
14 |
15 | @for $i from 0 through 100 {
16 | &.is-#{$i}\%, {
17 | width: $i * 1%;
18 | }
19 | }
20 | }
21 |
22 | .meter--label {
23 | position: absolute;
24 | top: 0; bottom: 0;
25 | left: 0; right: 0;
26 | display: flex;
27 | justify-content: center;
28 | align-items: center;
29 | font-size: 0.8em;
30 | font-weight: bold;
31 | }
32 | }
33 |
34 | .meter.is-progress {
35 | border-radius: $meter-progress-border-radius;
36 | border: $meter-progress-border-width solid $meter-progress-border-color;
37 | height: 1.5rem;
38 | color: $meter-progress-color;
39 |
40 | .meter--bar {
41 | border-radius: $meter-progress-border-radius;
42 | background-color: $meter-progress-inner-color;
43 | }
44 | }
45 |
46 | .meter.is-question-score {
47 | background-color: $meter-question-score-outer-color;
48 | max-width: $meter-max-width;
49 | border-radius: $meter-question-score-border-radius;
50 |
51 | &::before {
52 | content: '';
53 | display: block;
54 | position: absolute;
55 | height: 100%;
56 | width: $meter-question-score-dash-width;
57 | left: calc(50% - #{$meter-question-score-dash-width*0.5});
58 | right: calc(50% - #{$meter-question-score-dash-width*0.5});
59 | z-index: 1;
60 | background-color: $meter-question-score-dash-color;
61 | }
62 |
63 | .meter--bar {
64 | position: absolute;
65 | height: 100%;
66 | z-index: 0;
67 |
68 | @for $i from 0 through 49 {
69 | &.is-#{$i}\% {
70 | width: (50 - $i) * 1%;
71 | right: 50%;
72 | border-top-left-radius: $meter-question-score-border-radius;
73 | border-bottom-left-radius: $meter-question-score-border-radius;
74 | background-color: $meter-question-score-negative-color;
75 | }
76 | }
77 |
78 | &.is-50\% {
79 | left: 50%;
80 | right: 50%;
81 | width: 0;
82 | }
83 |
84 | @for $i from 51 through 100 {
85 | &.is-#{$i}\% {
86 | width: ($i - 50) * 1%;
87 | left: 50%;
88 | border-top-right-radius: $meter-question-score-border-radius;
89 | border-bottom-right-radius: $meter-question-score-border-radius;
90 | background-color: $meter-question-score-positive-color;
91 | }
92 | }
93 | }
94 | }
--------------------------------------------------------------------------------
/src/specific/_toc.scss:
--------------------------------------------------------------------------------
1 | .toc {
2 | display: flex;
3 | flex-direction: column;
4 | align-items: stretch;
5 |
6 | button.toc--header {
7 | background: none;
8 | font: inherit;
9 | cursor: pointer;
10 | font-weight: $toc-header-font-weight;
11 | background-color: $toc-header-active-background-color;
12 | color: $toc-header-active-color;
13 | }
14 |
15 | .toc--header {
16 | margin-top: $toc-header-top-margin * $margin-unit;
17 | align-self: flex-start;
18 | font-weight: $toc-header-font-weight;
19 | border: $toc-outer-border-width solid $toc-border-color;
20 | border-bottom-width: 0;
21 | background-color: $toc-header-active-background-color;
22 | padding: $toc-header-padding-y*$padding-unit $toc-header-padding-x*$padding-unit;
23 | color: $toc-header-active-color;
24 | }
25 |
26 | .toc--entry {
27 | display: flex;
28 | border: $toc-outer-border-width solid $toc-border-color;
29 | border-top-width: $toc-inner-border-width;
30 | font-size: $toc-entry-font-size;
31 | padding: $toc-entry-padding * $padding-unit;
32 |
33 | &:not(:last-of-type) {
34 | border-bottom: none;
35 | }
36 |
37 | .toc--icon {
38 | width: $toc-icon-width;
39 | text-align: center;
40 | }
41 | .toc--badge {
42 | min-width: $toc-badge-min-width;
43 | padding: $toc-badge-padding * $padding-unit;
44 |
45 | .badge {
46 | display: block;
47 | width: 100%;
48 | border-radius: 0;
49 | text-align: center;
50 | }
51 | }
52 |
53 | .toc--full {
54 | flex-grow: 1;
55 | width: 0;
56 | padding: $toc-full-padding-y*$padding-unit $toc-full-padding-x*$padding-unit;
57 |
58 | p {
59 | margin: 0;
60 | }
61 | }
62 | }
63 |
64 | .toc--header + .toc--entry {
65 | border-top-width: $toc-outer-border-width;
66 | }
67 |
68 | a.toc--entry {
69 | color: inherit;
70 | text-decoration: none;
71 |
72 | &:hover {
73 | background-color: $toc-entry-hover-background-color;
74 | }
75 | }
76 |
77 | &:not(.is-active) {
78 | button.toc--header {
79 | background-color: white;
80 | border-bottom-width: $toc-outer-border-width;
81 | }
82 | button.toc--header ~ .toc--entry {
83 | display: none;
84 | }
85 | }
86 | }
--------------------------------------------------------------------------------
/src/specific/_tools.scss:
--------------------------------------------------------------------------------
1 | .tools {
2 | display: flex;
3 | padding: $tools-padding-y*$padding-unit $tools-padding-x*$padding-unit;
4 | clear: both;
5 | flex-wrap: wrap;
6 |
7 | .tools--item {
8 | background-color: $tools-item-background-color;
9 | font: inherit;
10 | font-size: $tools-item-font-size;
11 | font-weight: $tools-item-font-weight;
12 | border: none;
13 | color: $tools-item-color;
14 | padding: $tools-item-padding-y*$padding-unit $tools-item-padding-x*$padding-unit;
15 | margin: $tools-item-margin-y*$margin-unit $tools-item-margin-x*$margin-unit;
16 | cursor: pointer;
17 | display: block;
18 | text-decoration: none;
19 |
20 | line-height: 1;
21 |
22 | transition: $default-transition;
23 |
24 | &:focus {
25 | background-color: $tools-item-active-background-color;
26 | text-decoration: none;
27 | }
28 |
29 | &:hover {
30 | background-color: $tools-item-active-background-color;
31 | color: $tools-item-active-color;
32 | text-decoration: none;
33 | }
34 |
35 | &:active,
36 | &.is-active {
37 | background-color: $tools-item-active-background-color;
38 | color: $tools-item-active-color;
39 | box-shadow: $tools-item-active-inner-shadow inset;
40 | text-decoration: none;
41 | }
42 |
43 | &.is-danger {
44 | background-color: $tools-item-danger-background-color;
45 | color: $tools-item-danger-color;
46 |
47 | &:focus {
48 | color: $tools-item-danger-active-color;
49 | background-color: $tools-item-danger-hover-background-color;
50 | }
51 |
52 | &:hover {
53 | color: $tools-item-danger-active-color;
54 | background-color: $tools-item-danger-hover-background-color;
55 | }
56 |
57 | &:active,
58 | &.is-active {
59 | color: $tools-item-danger-active-color;
60 | background-color: $tools-item-danger-active-background-color;
61 | box-shadow: $tools-item-danger-active-inner-shadow inset;
62 | }
63 | }
64 |
65 | &.is-danger.is-filled {
66 | color: $tools-item-danger-filled-color;
67 | background-color: $tools-item-danger-filled-background-color;
68 |
69 | &:focus {
70 | color: $tools-item-danger-filled-active-color;
71 | background-color: $tools-item-danger-filled-hover-background-color;
72 | }
73 |
74 | &:hover {
75 | color: $tools-item-danger-filled-active-color;
76 | background-color: $tools-item-danger-filled-hover-background-color;
77 | }
78 |
79 | &:active,
80 | &.is-active {
81 | color: $tools-item-danger-filled-active-color;
82 | background-color: $tools-item-danger-filled-active-background-color;
83 | box-shadow: inset;
84 | }
85 | }
86 | }
87 | }
--------------------------------------------------------------------------------
/src/specific/specific.scss:
--------------------------------------------------------------------------------
1 | /*
2 | * Codidact Design (Co-Design)
3 | * ===========================
4 | * Module: SPECIFIC
5 | *
6 | * This code is licensed under the terms of the MIT
7 | * license. You should have obtained a copy of it
8 | * with this source code. You should find it in the
9 | * file named "LICENSE" in the topmost folder.
10 | *
11 | */
12 |
13 | /* First import configuration stylesheet */
14 | @import "_config.scss";
15 |
16 | /* Then the components */
17 | @import "_category-header.scss";
18 | @import "_diff.scss";
19 | @import "_toc.scss";
20 | @import "_meter.scss";
21 | @import "_tools.scss";
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "removeComments": true,
4 | "outDir": "./js/",
5 | "outFile": "./js/co-design.js",
6 | "rootDir": "./js_src/",
7 | "target": "ES5",
8 | "alwaysStrict": true
9 | }
10 | }
11 |
--------------------------------------------------------------------------------