working on css design system

This commit is contained in:
2024-08-02 19:07:18 +02:00
parent 3885b5135b
commit fb43eddefc
16 changed files with 1283 additions and 1103 deletions
+373 -323
View File
@@ -1,378 +1,428 @@
$news-bg: #fffbeb;
$news-accent-bg: #f8e8b1;
// $news-bg: #fffbeb;
// $news-accent-bg: #f8e8b1;
@import './mixins.scss';
//
// Components - for complex parts of the UI like search bars or compound buttons
//
.material-symbols-outlined {
display: inline-grid;
place-content: center;
font-size: 24px;
font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 24;
}
.title {
font-family: 'Iosevka', monospace;
font-weight: 700;
font-size: 28px;
}
.search {
width: 100%;
height: 2.5rem;
@include neo-brutalist-card;
display: grid;
grid-template-columns: 1fr auto;
align-items: center;
cursor: pointer;
background: #fff;
&:hover,
&:hover input[type='text'] {
background: #f8f8f8;
}
input[type='text'] {
border: none;
box-shadow: none;
outline: none;
height: 100%;
padding: 0;
padding-left: 0.35rem;
}
@layer component {
//
// Components - for complex parts of the UI like search bars or compound buttons
//
.material-symbols-outlined {
padding: 0 0.5rem;
display: inline-grid;
place-content: center;
font-size: 24px;
font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 24;
}
}
.flex-column {
display: flex;
flex-direction: column;
gap: 1rem;
}
.flex-row {
display: flex;
flex-direction: row;
gap: 1rem;
}
// just to know for reference
.fake-masonry {
display: grid;
grid-template-columns: repeat(var(--columns), 1fr);
grid-auto-flow: dense;
& > * {
grid-row: span var(--masonry-height);
.title {
font-family: 'Iosevka', monospace;
font-weight: 700;
font-size: 28px;
}
}
.search-results {
width: 100%;
display: flex;
flex-direction: column;
gap: 1rem;
.search-result {
.search {
width: 100%;
display: grid;
grid-template-columns: auto auto 1fr auto;
grid-template-areas: 'icon text . right';
align-items: center;
gap: 0.5rem;
padding: 0.5rem;
background: #fff;
height: 2.5rem;
@include neo-brutalist-card;
a {
display: contents;
display: grid;
grid-template-columns: 1fr auto;
align-items: center;
cursor: pointer;
background: #fff;
&:hover,
&:hover input[type='text'] {
background: #f8f8f8;
}
& > .icon {
grid-area: icon;
display: grid;
input[type='text'] {
border: none;
box-shadow: none;
outline: none;
height: 100%;
padding: 0;
padding-left: 0.35rem;
}
& > .text {
grid-area: text;
display: grid;
}
& > .right {
grid-area: right;
display: grid;
.material-symbols-outlined {
padding: 0 0.5rem;
}
}
}
.appunti-scrollable {
display: flex;
overflow-x: auto;
.flex-column {
display: flex;
flex-direction: column;
gap: 1rem;
}
.flex-row {
display: flex;
flex-direction: row;
gap: 1rem;
}
// just to know for reference
.fake-masonry {
display: grid;
grid-template-columns: repeat(var(--columns), 1fr);
grid-auto-flow: dense;
& > * {
grid-row: span var(--masonry-height);
}
}
.search-results {
width: 100%;
display: flex;
flex-direction: column;
gap: 1rem;
.search-result {
width: 100%;
display: grid;
grid-template-columns: auto auto 1fr auto;
grid-template-areas: 'icon text . right';
align-items: center;
gap: 0.5rem;
padding: 0.5rem;
background: #fff;
@include neo-brutalist-card;
a {
display: contents;
}
& > .icon {
grid-area: icon;
display: grid;
}
& > .text {
grid-area: text;
display: grid;
}
& > .right {
grid-area: right;
display: grid;
}
}
}
.appunti-scrollable {
display: flex;
overflow-x: auto;
.appunti-list {
padding: 2px;
padding-bottom: 1rem;
}
}
.appunti-list {
padding: 2px;
padding-bottom: 1rem;
}
}
.appunti-list {
display: grid;
grid-auto-flow: column;
gap: 3rem;
overflow-x: auto;
max-width: 100%;
}
.appunti-item {
display: flex;
flex-direction: column;
gap: 0.25rem;
color: #444;
& > .thumbnail {
width: 10rem;
aspect-ratio: 10 / 14;
background: #e0e0e0;
@include neo-brutalist-card($hoverable: true);
}
& > .thumbnail + * {
font-weight: 700;
padding-top: 0.25rem;
}
& > .title,
& > .course,
& > .author,
& > .course-year {
padding-left: 0.5rem;
font-size: 16px;
}
}
.article-list {
display: grid;
grid-auto-flow: row;
max-width: 100%;
gap: 2rem;
grid-template-columns: repeat(auto-fill, minmax(25rem, 1fr));
grid-auto-rows: auto;
.article {
display: grid;
grid-template-rows: auto auto auto;
grid-auto-flow: column;
background: var(--card-bg, $project-card-bg);
color: #000e;
gap: 3rem;
overflow-x: auto;
max-width: 100%;
}
.appunti-item {
display: flex;
flex-direction: column;
gap: 0.25rem;
color: #444;
& > .thumbnail {
width: 10rem;
aspect-ratio: 10 / 14;
background: #e0e0e0;
@include neo-brutalist-card($hoverable: true);
}
& > .thumbnail + * {
font-weight: 700;
padding-top: 0.25rem;
}
& > .title,
& > .course,
& > .author,
& > .course-year {
padding-left: 0.5rem;
font-size: 16px;
}
}
.article-list {
display: grid;
grid-auto-flow: row;
max-width: 100%;
gap: 2rem;
grid-template-columns: repeat(auto-fill, minmax(25rem, 1fr));
grid-auto-rows: auto;
.article {
display: grid;
grid-template-rows: auto auto auto;
background: var(--card-bg, $project-card-bg);
color: #000e;
@include neo-brutalist-card($size: 3px, $offset: 9px);
row-gap: 0.5rem;
padding: 1rem;
.description {
font-size: 16px;
}
.tags {
display: flex;
gap: 0.5rem;
flex-wrap: wrap;
font-size: 14px;
font-weight: 600;
color: #555;
}
}
}
.news-list {
display: grid;
grid-auto-flow: column;
// .news-item {
// background: $news-bg;
// color: #111;
// @include neo-brutalist-card($size: 3px, $offset: 9px);
// display: flex;
// flex-direction: column;
// width: 22rem;
// max-height: 27rem;
// overflow: hidden;
// ::-webkit-scrollbar {
// width: 10px;
// }
// ::-webkit-scrollbar-thumb {
// background-color: #c67e14;
// border: 2px solid #222;
// &:hover {
// background-color: #e69419;
// }
// }
// a {
// font-weight: 600;
// text-decoration: none;
// color: #c67e14;
// &:hover {
// text-decoration: underline solid 2px;
// }
// }
// & > .title {
// padding: 1rem;
// background: $news-accent-bg;
// line-height: 1;
// font-size: 26px;
// }
// a.title {
// color: #83530c;
// }
// & > .abstract {
// flex-grow: 1;
// padding: 1rem;
// overflow-y: auto;
// @extend .text;
// }
// & > .content {
// display: flex;
// padding: 1rem;
// flex-direction: column;
// gap: 0.5rem;
// background: #fff8da;
// & > .continue {
// padding: 1rem;
// display: grid;
// align-items: end;
// justify-content: end;
// }
// & > .description {
// font-size: 16px;
// line-height: 1.5;
// flex-grow: 1;
// }
// & > .tags {
// display: flex;
// gap: 0.5rem;
// flex-wrap: wrap;
// font-size: 14px;
// color: #555;
// }
// & > .date {
// font-size: 14px;
// font-style: italic;
// font-weight: 600;
// color: #0008;
// }
// & > .author {
// font-weight: 600;
// font-size: 15px;
// color: #555;
// }
// }
// }
}
//
// Cards
//
.card {
display: grid;
--card-base-internal: var(--card-base, #f8f8f8);
background: var(--card-base-internal);
color: color-mix(in srgb, var(--card-base-internal), #000 80%);
@include neo-brutalist-card($size: 3px, $offset: 9px);
row-gap: 0.5rem;
padding: 1rem;
.description {
font-size: 16px;
// Variants
&.large {
padding: 2rem;
@include neo-brutalist-card($size: 4px, $offset: 8px);
row-gap: 1rem;
& > .title {
font-size: 36px;
font-weight: 700;
}
& > .text {
font-size: 18px;
}
}
.tags {
// Child Items
& > .title {
color: color-mix(in srgb, var(--card-base-internal), #000 75%);
font-size: 26px;
font-weight: 700;
}
& > .text {
font-size: 16px;
&.small {
color: color-mix(in srgb, var(--card-base-internal), #000 75%);
font-size: 14px;
font-weight: 600;
}
&.dimmed {
color: color-mix(in srgb, var(--card-base-internal), #000 50%);
}
}
& > .tags {
display: flex;
gap: 0.5rem;
flex-wrap: wrap;
font-size: 14px;
font-weight: 600;
color: #555;
}
}
}
.news-list {
display: grid;
grid-auto-flow: column;
a {
color: color-mix(in srgb, var(--card-base-internal), #000 60%);
font-weight: 600;
.news-item {
background: $news-bg;
color: #111;
@include neo-brutalist-card($size: 3px, $offset: 9px);
display: flex;
flex-direction: column;
width: 22rem;
max-height: 27rem;
overflow: hidden;
::-webkit-scrollbar {
width: 10px;
}
::-webkit-scrollbar-thumb {
background-color: #c67e14;
border: 2px solid #222;
&:hover {
background-color: #e69419;
&:hover {
text-decoration: underline solid 2px;
}
}
}
a {
font-weight: 600;
text-decoration: none;
color: #c67e14;
&:hover {
text-decoration: underline solid 2px;
}
}
& > .title {
padding: 1rem;
background: $news-accent-bg;
line-height: 1;
font-size: 26px;
a:hover {
text-decoration: underline solid 2px;
}
a.title {
color: #83530c;
&:hover {
text-decoration: underline solid 3px;
}
}
}
& > .abstract {
flex-grow: 1;
//
// Card List
//
padding: 1rem;
.card-list {
display: grid;
grid-auto-flow: row;
overflow-y: auto;
max-width: 100%;
@extend .text;
}
gap: 2rem;
grid-template-columns: repeat(auto-fit, minmax(25rem, 1fr));
grid-auto-rows: auto;
& > .content {
display: flex;
padding: 1rem;
flex-direction: column;
gap: 0.5rem;
background: #fff8da;
& > .continue {
padding: 1rem;
display: grid;
align-items: end;
justify-content: end;
}
& > .description {
font-size: 16px;
line-height: 1.5;
flex-grow: 1;
}
& > .tags {
display: flex;
gap: 0.5rem;
flex-wrap: wrap;
font-size: 14px;
color: #555;
}
& > .date {
font-size: 14px;
font-style: italic;
font-weight: 600;
color: #0008;
}
& > .author {
font-weight: 600;
font-size: 15px;
color: #555;
}
& > .card {
max-width: 25rem;
}
}
}
//
// Cards
//
.card {
display: grid;
--card-base-internal: var(--card-base, #f8f8f8);
background: var(--card-base-internal);
color: color-mix(in srgb, var(--card-base-internal), #000 80%);
@include neo-brutalist-card($size: 3px, $offset: 9px);
row-gap: 0.5rem;
padding: 1rem;
// Variants
&.large {
padding: 2rem;
@include neo-brutalist-card($size: 4px, $offset: 8px);
row-gap: 1rem;
& > .title {
font-size: 36px;
font-weight: 700;
}
& > .text {
font-size: 18px;
}
}
// Child Items
& > .title {
color: color-mix(in srgb, var(--card-base-internal), #000 75%);
font-size: 26px;
font-weight: 700;
}
& > .text {
font-size: 16px;
}
& > .tags {
display: flex;
gap: 0.5rem;
flex-wrap: wrap;
font-size: 14px;
font-weight: 600;
color: #555;
}
}
+32 -56
View File
@@ -16,77 +16,53 @@ $project-card-bg: #a2d4f3;
$screen-desktop-min: 1024px;
@layer common, typography, component, page;
@import './mixins.scss';
@import './typography.scss';
*,
*::before,
*::after {
box-sizing: border-box;
font: inherit;
margin: 0;
}
@layer common {
*,
*::before,
*::after {
box-sizing: border-box;
font: inherit;
margin: 0;
}
html {
height: 100%;
}
html {
height: 100%;
}
html,
body {
min-height: 100%;
margin: 0;
html,
body {
min-height: 100%;
margin: 0;
font-family: 'Open Sans', sans-serif;
font-size: 18px;
color: #222;
}
font-family: 'Open Sans', sans-serif;
font-size: 18px;
color: #222;
}
// html {
// scroll-snap-type: y proximity;
// scroll-padding-top: 4rem;
// }
// html {
// scroll-snap-type: y proximity;
// scroll-padding-top: 4rem;
// }
img {
display: block;
}
img {
display: block;
}
a {
color: inherit;
text-decoration: none;
a {
color: inherit;
text-decoration: none;
}
}
//
// Typography
//
.text {
display: block;
line-height: 1.5;
p + p {
margin-top: 0.5rem;
}
em {
font-style: italic;
}
strong {
font-weight: 600;
}
a,
a:visited {
color: #1e6733;
font-weight: 600;
&:hover {
text-decoration: underline 2px solid;
}
}
}
@import './controls.scss';
@import './components.scss';
+571 -520
View File
File diff suppressed because it is too large Load Diff
+119 -95
View File
@@ -24,108 +24,132 @@
margin-bottom: 0.25rem;
}
p + h#{$i} {
margin-top: 0.75rem * $factor;
}
// p + h#{$i} {
// margin-top: 0.75rem * $factor;
// }
}
}
@include geometric-headings;
.text-content {
& > * {
max-width: 46rem;
}
pre,
code {
background: var(--code-bg, #f0f0f0) !important;
font-family: 'Source Code Pro', monospace;
font-weight: 400;
font-size: 16px;
}
code {
border-radius: 0.25rem;
padding: 0.125rem;
}
pre {
margin: 2rem auto;
padding: 0.5rem 1rem;
// width: 100%;
max-width: 80ch;
width: fit-content;
line-height: 1.5;
border-radius: 0.25rem;
box-shadow: 0.25rem 0.25rem 0 0 #333;
border: 2px solid #333;
code {
padding: 0;
}
}
p {
line-height: 1.75;
margin: 1rem auto;
}
strong {
font-weight: 500;
}
em {
font-style: italic;
}
@layer typography {
@include geometric-headings;
h1 {
margin-bottom: 2rem;
text-align: center;
}
.text-content,
.text {
line-height: 1.5;
h1,
h2,
h3,
h4 {
font-weight: 700;
color: #333;
}
h1,
h2,
h3,
h4,
ol,
ul {
margin-left: auto;
margin-right: auto;
}
a,
a:visited {
color: var(--zone-color, #1e6733);
font-weight: 600;
&:hover {
text-decoration: underline 2px solid;
}
}
padding: 2rem 0 3rem;
@media screen and (max-width: 1024px) {
& > * {
margin: 0 0.75rem;
max-width: 46rem;
}
pre,
code {
background: color-mix(in lab, var(--card-base-internal, #ededed), #fff 35%) !important;
// background: color-mix(in lab, var(--zone-color), #fff 75%) !important;
// background: var(--code-bg, #00000022) !important;
font-family: 'Source Code Pro', monospace;
font-weight: 400;
font-size: 16px;
}
code {
border-radius: 0.25rem;
padding: 0.125rem 0.3rem;
}
pre {
margin: 2rem auto;
padding: 0.5rem 1rem;
// width: 100%;
max-width: 80ch;
width: fit-content;
line-height: 1.5;
border-radius: 0.25rem;
box-shadow: 0.25rem 0.25rem 0 0 #333;
border: 2px solid #333;
code {
padding: 0;
}
}
p {
line-height: 1.75;
margin: 0 auto;
}
p + p {
margin-top: 1rem;
}
h1 + p,
h2 + p,
h3 + p,
h4 + p {
margin-top: 1rem;
}
p:has(+ h1, + h2, + h3, + h4) {
margin-bottom: 1rem;
}
strong {
font-weight: 600;
}
em {
font-style: italic;
}
@include geometric-headings;
h1 {
margin-bottom: 2rem;
text-align: center;
}
h1,
h2,
h3,
h4 {
font-weight: 700;
color: #333;
// trick to fix anchor links with sticky header
padding-top: 7rem;
margin-top: -6.5rem;
}
h1,
h2,
h3,
h4,
ol,
ul {
margin-left: auto;
margin-right: auto;
}
a,
a:visited {
color: var(--zone-color, #1e6733);
font-weight: 600;
&:hover {
text-decoration: underline 2px solid;
}
}
@media screen and (max-width: 1024px) {
& > * {
margin: 0 0.75rem;
}
}
}
}