Skip to content

Commit d5bc0cf

Browse files
committed
feat: Added small fade on tabs when scrollable
1 parent 3344afc commit d5bc0cf

File tree

2 files changed

+50
-25
lines changed

2 files changed

+50
-25
lines changed

assets/css/v2/style.css

Lines changed: 50 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -913,32 +913,19 @@ blockquote.side-callout {
913913
.tabs-container {
914914
/* border-bottom: 1px solid black; */
915915
white-space: nowrap;
916+
position: relative;
916917

917-
/* Lines extend 1rem into gutter on both sides */
918-
width: calc(100% + 2rem);
919-
margin-left: -1rem;
920-
921-
display: flex;
922-
flex-direction: row;
923-
align-items: end;
924-
925-
* {
926-
flex-grow: 0;
927-
}
928-
929-
& > :last-child {
930-
/* Extend the last child */
931-
flex-grow: 1;
918+
&::after {
919+
content: "";
920+
position: absolute;
921+
display: block;
922+
border-bottom: 1px solid black;
923+
bottom: 0;
924+
right: 0;
925+
width: 2rem;
932926
}
933927
}
934928

935-
.tabs-line {
936-
display: block;
937-
background-color: white;
938-
border-bottom: 1px solid black;
939-
width: 2rem;
940-
}
941-
942929
.nav-tabs {
943930
overflow-x: scroll;
944931
overflow-y: hidden;
@@ -949,11 +936,51 @@ blockquote.side-callout {
949936
display: flex;
950937
justify-content: start;
951938
margin: 0;
952-
padding: 0;
939+
padding: 0 2rem;
940+
position: relative;
953941

954942
> :not(:last-child) {
955943
border-right: none;
956944
}
945+
946+
&::before {
947+
content: "";
948+
position: absolute;
949+
display: block;
950+
border-bottom: 1px solid black;
951+
bottom: 0;
952+
left: 0;
953+
width: 2rem;
954+
}
955+
956+
&::after {
957+
content: "";
958+
position: relative;
959+
display: block;
960+
border-bottom: 1px solid black;
961+
bottom: 0;
962+
left: 0;
963+
width: 100%;
964+
}
965+
966+
--scrollbar-width: 1px;
967+
--mask-height: 32px;
968+
--mask-image-content: linear-gradient(
969+
to right,
970+
transparent,
971+
black var(--mask-height),
972+
black calc(100% - var(--mask-height)),
973+
transparent
974+
);
975+
976+
--mask-size-content: 100% calc(100% - var(--scrollbar-width));
977+
978+
--mask-image-scrollbar: linear-gradient(black, black);
979+
--mask-size-scrollbar: 100% var(--scrollbar-width);
980+
mask-image: var(--mask-image-content), var(--mask-image-scrollbar);
981+
mask-size: var(--mask-size-content), var(--mask-size-scrollbar);
982+
mask-position: 0 0, 0 100%;
983+
mask-repeat: no-repeat, no-repeat;
957984
}
958985

959986
.nav-item {

layouts/shortcodes/tabs.html

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
{{- $tabs := .Scratch.Get "tabs" -}}
44
{{- if .Inner -}}{{- /* We don't use the inner content, but Hugo will complain if we don't reference it. */ -}}{{- end -}}
55
<div class="tabs-container">
6-
<span class="tabs-line"></span>
76
<ul class="nav nav-tabs" id="{{ $tab_set_id }}" role="tablist">
87
{{- range $i, $e := $tabs -}}
98
{{- $id := printf "%s-%d" $tab_set_id $i -}}
@@ -14,7 +13,6 @@
1413
{{- end -}}
1514
{{- end -}}
1615
</ul>
17-
<span class="tabs-line"></span>
1816
</div>
1917
<div class="tab-content" id="{{ $tab_set_id }}">
2018
{{- range $i, $e := $tabs -}}

0 commit comments

Comments
 (0)