Skip to content

Commit

Permalink
wip(curriculum): use mixins
Browse files Browse the repository at this point in the history
  • Loading branch information
LeoMcA committed Sep 20, 2024
1 parent 6932ab8 commit 6670d71
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 69 deletions.
31 changes: 31 additions & 0 deletions client/src/curriculum/_mixins.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
@mixin note {
background-color: var(--curriculum-bg-color-note);
border: 0;
border-radius: var(--elem-radius);
margin: 1rem;
padding: 1rem;

ol,
ul {
padding-left: 1rem;

li:last-child {
margin-bottom: 0;
}
}

ol,
ul,
p {
margin-top: 0.5rem;
}

> p:first-child {
// The "Notes:" paragraph.
margin-top: 0;
}

> :last-child {
margin-bottom: 0;
}
}
46 changes: 6 additions & 40 deletions client/src/curriculum/about.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
@use "../ui/vars" as *;
@use "mixins" as curriculum;
@use "../ui/atoms/button/mixins" as button;

.curriculum-content-container.curriculum-about {
.curriculum-content {
Expand Down Expand Up @@ -44,51 +46,15 @@
}

h3#educators + .section-content blockquote:not(.curriculum-notes) {
align-items: center;
// PDF download banner

background-color: var(--curriculum-bg-color-note);
border: 0;
border-radius: var(--elem-radius);
display: flex;
flex-direction: column;
gap: 1rem;
margin: 1rem;
padding: 1rem;

> p:last-child a:only-child {
--button-bg: var(--button-secondary-default);
--button-border-color: var(--border-primary);
--button-color: var(--text-secondary);
--button-bg-hover: var(--button-secondary-hover);
--button-bg-active: var(--button-secondary-active);
@include curriculum.note;

--button-font: var(--type-emphasis-m);
--button-padding: 0.43rem 1rem;
--button-radius: 0.25rem;

background-color: var(--button-bg);
border: 1px solid var(--button-border-color);
border-radius: var(--button-radius);
color: var(--button-color);
display: inline-block;
font: var(--button-font);
letter-spacing: normal;
padding: var(--button-padding);
> p:last-child {
text-align: center;
text-decoration: none;

&.external:after {
display: none;
}

&:hover {
--button-border-color: var(--button-bg-hover);
--button-bg: var(--button-bg-hover);
}

&:active {
--button-bg: var(--button-bg-active);
a:only-child {
@include button.secondary;
}
}
}
Expand Down
31 changes: 2 additions & 29 deletions client/src/curriculum/index.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@use "../ui/vars" as *;
@use "mixins" as curriculum;

.curriculum {
--background-toc-active: var(--curriculum-bg-color);
Expand Down Expand Up @@ -227,35 +228,7 @@
}

blockquote.curriculum-notes {
background-color: var(--curriculum-bg-color-note);
border: 0;
border-radius: var(--elem-radius);
margin: 1rem;
padding: 1rem;

ol,
ul {
padding-left: 1rem;

li:last-child {
margin-bottom: 0;
}
}

ol,
ul,
p {
margin-top: 0.5rem;
}

> p:first-child {
// The "Notes:" paragraph.
margin-top: 0;
}

> :last-child {
margin-bottom: 0;
}
@include curriculum.note;
}

p.curriculum-outcomes {
Expand Down
49 changes: 49 additions & 0 deletions client/src/ui/atoms/button/_mixins.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
@mixin _button {
--button-font: var(--type-emphasis-m);
--button-padding: 0.43rem 1rem;
--button-radius: var(--elem-radius, 0.25rem);

background-color: var(--button-bg);
border: 1px solid var(--button-border-color);
border-radius: var(--button-radius);
color: var(--button-color);
display: inline-block;
font: var(--button-font);
letter-spacing: normal;
padding: var(--button-padding);
text-align: center;
text-decoration: none;

&.external:after {
display: none;
}

&:hover {
--button-border-color: var(--button-bg-hover);
--button-bg: var(--button-bg-hover);
}

&:active {
--button-bg: var(--button-bg-active);
}
}

@mixin primary {
--button-bg: var(--button-primary-default);
--button-bg-hover: var(--button-primary-hover);
--button-bg-active: var(--button-primary-active);
--button-border-color: var(--button-primary-default);
--button-color: var(--background-primary);

@include _button;
}

@mixin secondary {
--button-bg: var(--button-secondary-default);
--button-bg-hover: var(--button-secondary-hover);
--button-bg-active: var(--button-secondary-active);
--button-border-color: var(--border-primary);
--button-color: var(--text-secondary);

@include _button;
}

0 comments on commit 6670d71

Please sign in to comment.