From 332ec93366315fa1ed7b4acd7a3407c96e8ddfa7 Mon Sep 17 00:00:00 2001 From: sadbeast Date: Wed, 31 Jan 2024 17:47:56 -0800 Subject: initial mistake --- app/assets/stylesheets/components/_accordion.scss | 116 ++++++++++++ app/assets/stylesheets/components/_card.scss | 36 ++++ app/assets/stylesheets/components/_dropdown.scss | 214 ++++++++++++++++++++++ app/assets/stylesheets/components/_modal.scss | 168 +++++++++++++++++ app/assets/stylesheets/components/_nav.scss | 141 ++++++++++++++ app/assets/stylesheets/components/_progress.scss | 89 +++++++++ 6 files changed, 764 insertions(+) create mode 100644 app/assets/stylesheets/components/_accordion.scss create mode 100644 app/assets/stylesheets/components/_card.scss create mode 100644 app/assets/stylesheets/components/_dropdown.scss create mode 100644 app/assets/stylesheets/components/_modal.scss create mode 100644 app/assets/stylesheets/components/_nav.scss create mode 100644 app/assets/stylesheets/components/_progress.scss (limited to 'app/assets/stylesheets/components') diff --git a/app/assets/stylesheets/components/_accordion.scss b/app/assets/stylesheets/components/_accordion.scss new file mode 100644 index 0000000..59b2c65 --- /dev/null +++ b/app/assets/stylesheets/components/_accordion.scss @@ -0,0 +1,116 @@ +/** + * Accordion (
) + */ + +details { + display: block; + margin-bottom: var(--spacing); + padding-bottom: var(--spacing); + border-bottom: var(--border-width) solid var(--accordion-border-color); + + summary { + line-height: 1rem; + list-style-type: none; + cursor: pointer; + + &:not([role]) { + color: var(--accordion-close-summary-color); + } + + @if $enable-transitions { + transition: color var(--transition); + } + + // Reset marker + &::-webkit-details-marker { + display: none; + } + + &::marker { + display: none; + } + + &::-moz-list-bullet { + list-style-type: none; + } + + // Marker + &::after { + display: block; + width: 1rem; + height: 1rem; + margin-inline-start: calc(var(--spacing, 1rem) * 0.5); + float: right; + transform: rotate(-90deg); + background-image: var(--icon-chevron); + background-position: right center; + background-size: 1rem auto; + background-repeat: no-repeat; + content: ""; + + @if $enable-transitions { + transition: transform var(--transition); + } + } + + &:focus { + outline: none; + + &:not([role="button"]) { + color: var(--accordion-active-summary-color); + } + } + + // Type button + &[role="button"] { + width: 100%; + text-align: left; + + // Marker + &::after { + height: calc(1rem * var(--line-height, 1.5)); + background-image: var(--icon-chevron-button); + } + + @if $enable-classes { + // .contrast + &:not(.outline).contrast { + // Marker + &::after { + background-image: var(--icon-chevron-button-inverse); + } + } + } + } + } + + // Open + &[open] { + > summary { + margin-bottom: calc(var(--spacing)); + + &:not([role]) { + &:not(:focus) { + color: var(--accordion-open-summary-color); + } + } + + &::after { + transform: rotate(0); + } + } + } +} + +[dir="rtl"] { + details { + summary { + text-align: right; + + &::after { + float: left; + background-position: left center; + } + } + } +} diff --git a/app/assets/stylesheets/components/_card.scss b/app/assets/stylesheets/components/_card.scss new file mode 100644 index 0000000..924415e --- /dev/null +++ b/app/assets/stylesheets/components/_card.scss @@ -0,0 +1,36 @@ +/** + * Card (
) + */ + +article { + margin: var(--block-spacing-vertical) 0; + padding: var(--block-spacing-vertical) var(--block-spacing-horizontal); + border-radius: var(--border-radius); + background: var(--card-background-color); + box-shadow: var(--card-box-shadow); + + > header, + > footer { + margin-right: calc(var(--block-spacing-horizontal) * -1); + margin-left: calc(var(--block-spacing-horizontal) * -1); + padding: calc(var(--block-spacing-vertical) * 0.66) + var(--block-spacing-horizontal); + background-color: var(--card-sectionning-background-color); + } + + > header { + margin-top: calc(var(--block-spacing-vertical) * -1); + margin-bottom: var(--block-spacing-vertical); + border-bottom: var(--border-width) solid var(--card-border-color); + border-top-right-radius: var(--border-radius); + border-top-left-radius: var(--border-radius); + } + + > footer { + margin-top: var(--block-spacing-vertical); + margin-bottom: calc(var(--block-spacing-vertical) * -1); + border-top: var(--border-width) solid var(--card-border-color); + border-bottom-right-radius: var(--border-radius); + border-bottom-left-radius: var(--border-radius); + } +} diff --git a/app/assets/stylesheets/components/_dropdown.scss b/app/assets/stylesheets/components/_dropdown.scss new file mode 100644 index 0000000..a16e6d2 --- /dev/null +++ b/app/assets/stylesheets/components/_dropdown.scss @@ -0,0 +1,214 @@ +/** + * Dropdown ([role="list"]) + */ + +// Menu +details[role="list"], +li[role="list"] { + position: relative; +} + +details[role="list"] summary + ul, +li[role="list"] > ul { + display: flex; + z-index: 99; + position: absolute; + top: auto; + right: 0; + left: 0; + flex-direction: column; + margin: 0; + padding: 0; + border: var(--border-width) solid var(--dropdown-border-color); + border-radius: var(--border-radius); + border-top-right-radius: 0; + border-top-left-radius: 0; + background-color: var(--dropdown-background-color); + box-shadow: var(--card-box-shadow); + color: var(--dropdown-color); + white-space: nowrap; + + li { + width: 100%; + margin-bottom: 0; + padding: calc(var(--form-element-spacing-vertical) * 0.5) + var(--form-element-spacing-horizontal); + list-style: none; + + &:first-of-type { + margin-top: calc(var(--form-element-spacing-vertical) * 0.5); + } + + &:last-of-type { + margin-bottom: calc(var(--form-element-spacing-vertical) * 0.5); + } + + a { + display: block; + margin: calc(var(--form-element-spacing-vertical) * -0.5) + calc(var(--form-element-spacing-horizontal) * -1); + padding: calc(var(--form-element-spacing-vertical) * 0.5) + var(--form-element-spacing-horizontal); + overflow: hidden; + color: var(--dropdown-color); + text-decoration: none; + text-overflow: ellipsis; + + &:hover { + background-color: var(--dropdown-hover-background-color); + } + } + } +} + +// Marker +details[role="list"] summary, +li[role="list"] > a { + &::after { + display: block; + width: 1rem; + height: calc(1rem * var(--line-height, 1.5)); + margin-inline-start: 0.5rem; + float: right; + transform: rotate(0deg); + background-image: var(--icon-chevron); + background-position: right center; + background-size: 1rem auto; + background-repeat: no-repeat; + content: ""; + } +} + +// Global dropdown only +details[role="list"] { + padding: 0; + border-bottom: none; + + // Style as