Skip to content

Commit

Permalink
👌 IMPROVE: Styling for tabs (#21)
Browse files Browse the repository at this point in the history
- Introduce "hover" state styling for tabs:
  The lifecycle of a tab is now "inactive -> hover -> active".
- Completely un-mix styling for different states of a tab.
- Use a higher contrast color for inactive tabs.
- Convert tab underline and overline to greys:
  A more neutral colour to fit in better with the rest of the content.

Co-authored-by: Pradyun Gedam <[email protected]>
  • Loading branch information
pradyunsg and pradyunsg authored Oct 19, 2021
1 parent c79d9d6 commit fab8233
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 9 deletions.
10 changes: 7 additions & 3 deletions docs/css_variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,13 @@ The defaults are:
--sd-color-card-header: transparent;
--sd-color-card-footer: transparent;
--sd-color-tabs-label-active: hsla(231, 99%, 66%, 1);
--sd-color-tabs-label-inactive: rgba(178, 206, 245, 0.62);
--sd-color-tabs-overline: rgb(207, 236, 238);
--sd-color-tabs-underline: rgb(207, 236, 238);
--sd-color-tabs-label-hover: hsla(231, 99%, 66%, 1);
--sd-color-tabs-label-inactive: hsl(0, 0%, 66%);
--sd-color-tabs-underline-active: hsla(231, 99%, 66%, 1);
--sd-color-tabs-underline-hover: rgba(178, 206, 245, 0.62);
--sd-color-tabs-underline-inactive: transparent;
--sd-color-tabs-overline: rgb(222, 222, 222);
--sd-color-tabs-underline: rgb(222, 222, 222);
--sd-fontsize-tabs-label: 1rem
}
```
2 changes: 1 addition & 1 deletion sphinx_design/compiled/style.min.css

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions style/_tabs.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

// Active tab label
&:checked + label {
border-color: var(--sd-color-tabs-label-active);
border-color: var(--sd-color-tabs-underline-active);
color: var(--sd-color-tabs-label-active);

// Show tabbed block content
Expand All @@ -23,7 +23,8 @@
}

&:not(:checked) + label:hover {
border-color: var(--sd-color-tabs-label-inactive);
color: var(--sd-color-tabs-label-hover);
border-color: var(--sd-color-tabs-underline-hover);
}

// Focused tab label
Expand All @@ -43,6 +44,7 @@
border-bottom: 0.125rem solid transparent;
margin-bottom: 0;
color: var(--sd-color-tabs-label-inactive);
border-color: var(--sd-color-tabs-underline-inactive);
cursor: pointer;
font-size: var(--sd-fontsize-tabs-label);
font-weight: 700;
Expand Down
10 changes: 7 additions & 3 deletions style/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,12 @@
--sd-color-card-footer: transparent;
// tabs
--sd-color-tabs-label-active: hsla(231, 99%, 66%, 1);
--sd-color-tabs-label-inactive: rgba(178, 206, 245, 0.62);
--sd-color-tabs-overline: rgb(207, 236, 238);
--sd-color-tabs-underline: rgb(207, 236, 238);
--sd-color-tabs-label-hover: hsla(231, 99%, 66%, 1);
--sd-color-tabs-label-inactive: hsl(0, 0%, 66%);
--sd-color-tabs-underline-active: hsla(231, 99%, 66%, 1);
--sd-color-tabs-underline-hover: rgba(178, 206, 245, 0.62);
--sd-color-tabs-underline-inactive: transparent;
--sd-color-tabs-overline: rgb(222, 222, 222);
--sd-color-tabs-underline: rgb(222, 222, 222);
--sd-fontsize-tabs-label: 1rem;
}

0 comments on commit fab8233

Please sign in to comment.