Skip to content

Commit c0af9ed

Browse files
committed
feat: Added small fade on tabs when scrollable
1 parent f5ea6ef commit c0af9ed

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
@@ -908,32 +908,19 @@ blockquote.side-callout {
908908
.tabs-container {
909909
/* border-bottom: 1px solid black; */
910910
white-space: nowrap;
911+
position: relative;
911912

912-
/* Lines extend 1rem into gutter on both sides */
913-
width: calc(100% + 2rem);
914-
margin-left: -1rem;
915-
916-
display: flex;
917-
flex-direction: row;
918-
align-items: end;
919-
920-
* {
921-
flex-grow: 0;
922-
}
923-
924-
& > :last-child {
925-
/* Extend the last child */
926-
flex-grow: 1;
913+
&::after {
914+
content: "";
915+
position: absolute;
916+
display: block;
917+
border-bottom: 1px solid black;
918+
bottom: 0;
919+
right: 0;
920+
width: 2rem;
927921
}
928922
}
929923

930-
.tabs-line {
931-
display: block;
932-
background-color: white;
933-
border-bottom: 1px solid black;
934-
width: 2rem;
935-
}
936-
937924
.nav-tabs {
938925
overflow-x: scroll;
939926
overflow-y: hidden;
@@ -944,11 +931,51 @@ blockquote.side-callout {
944931
display: flex;
945932
justify-content: start;
946933
margin: 0;
947-
padding: 0;
934+
padding: 0 2rem;
935+
position: relative;
948936

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

954981
.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)