Skip to content

Commit bafead1

Browse files
committed
update tabs and examples
1 parent 0aea703 commit bafead1

File tree

2 files changed

+39
-37
lines changed

2 files changed

+39
-37
lines changed

src/css/doc.css

Lines changed: 31 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1265,54 +1265,50 @@ body {
12651265
}
12661266

12671267
.doc .tabbed {
1268-
padding: 13px 0 0;
1268+
background: var(--body-background);
1269+
padding: 0;
12691270
margin: 0 -1rem 1.5rem;
1270-
background: rgba(var(--colors-neutral-15));
1271-
border: 1px solid rgba(var(--colors-neutral-20));
1272-
border-top-left-radius: 6px;
1273-
border-top-right-radius: 6px;
1271+
border: 1px solid var(--color-docs);
1272+
border-radius: 8px;
12741273
}
12751274

12761275
.doc .tabbed-tabs {
12771276
display: flex;
1277+
flex-direction: row;
12781278
margin: 0 1rem;
12791279
padding: 0;
1280-
/* background: #edf2f7; */
1281-
/* border-bottom: 1px solid #e6f8ff; */
1280+
gap: 1rem;
1281+
border-bottom: 1px solid rgba(var(--theme-light-palette-neutral-border-weak));
12821282
}
12831283

12841284
.doc .tabbed-tabs .tabbed-tab {
12851285
display: flex;
12861286
flex-grow: 0;
1287-
list-style-type: none;
12881287
font-size: 0.7rem;
12891288
font-weight: 600;
1290-
padding: 0.4rem 0.6rem;
1291-
margin-right: 0.5rem;
1292-
background: rgba(var(--colors-neutral-20));
1293-
border: 1px solid rgba(var(--colors-neutral-20));
1294-
border-top: 3px solid rgba(var(--colors-neutral-30));
1295-
border-top-left-radius: 6px;
1296-
border-top-right-radius: 6px;
12971289
border-bottom: none;
1298-
cursor: default;
1290+
cursor: pointer;
1291+
width: fit-content;
1292+
position: relative;
1293+
padding: 1rem;
12991294
}
13001295

1301-
.doc .tabbed-tabs .tabbed-tab--active {
1302-
margin-bottom: -1px;
1303-
background: var(--color-white);
1304-
color: var(--color-docs);
1305-
border: 1px solid var(--color-docs);
1306-
border-top: 3px solid var(--color-docs);
1307-
border-bottom: none;
1296+
.doc .tabbed-tabs .tabbed-tab span.ndl-tab-underline {
1297+
height: 3px;
1298+
position: absolute;
1299+
left: 0;
1300+
bottom: 0;
1301+
width: 100%;
1302+
border-top-left-radius: 9999px;
1303+
border-top-right-radius: 9999px;
1304+
}
1305+
1306+
.doc .tabbed-tabs .tabbed-tab--active span.ndl-tab-underline {
1307+
background: var(--color-docs);
13081308
}
13091309

13101310
.doc .tabbed-container {
13111311
padding: 1rem;
1312-
background: #fff;
1313-
border: 1px solid var(--color-docs);
1314-
border-top-left-radius: 6px;
1315-
border-top-right-radius: 6px;
13161312
}
13171313

13181314
.doc .tabbed-target {
@@ -1395,23 +1391,23 @@ body {
13951391
}
13961392

13971393
.exampleblock {
1398-
margin-top: 0.75rem;
1399-
border: 1px solid var(--example-border-color);
1394+
background: var(--body-background);
1395+
padding: 0;
1396+
margin: 0 -1rem 1.5rem;
1397+
border: 1px solid var(--color-docs);
1398+
border-radius: 8px;
14001399
}
14011400

14021401
.doc .exampleblock > .title,
14031402
.doc .exampleblock > .content {
14041403
padding: 0.5rem 0.75rem;
14051404
}
14061405

1407-
.doc .exampleblock > .content {
1408-
border-top: 1px solid var(--example-border-color);
1409-
}
1410-
14111406
.doc .exampleblock > .title {
14121407
color: var(--example-header-font-color);
1413-
background: var(--example-header-background);
1414-
margin-bottom: 0;
1408+
padding: 0.5rem 0;
1409+
margin: 0 1rem;
1410+
border-bottom: 1px solid var(--example-border-color);
14151411
}
14161412

14171413
.tabbed-container > .exampleblock {

src/js/08-tabs-block.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ document.addEventListener('DOMContentLoaded', function () {
164164
var tabs = elements.map(function (element) {
165165
var lang = element.getAttribute('data-lang')
166166
var tabText = casedLang(lang)
167-
var tabElement = createElement('li', 'tabbed-tab', [document.createTextNode(tabText)])
167+
var tabElement = createElement('div', 'tabbed-tab', [document.createTextNode(tabText)])
168168

169169
element.dataset.title = tabText
170170
element.dataset.lang = lang
@@ -202,7 +202,13 @@ document.addEventListener('DOMContentLoaded', function () {
202202
})
203203
}
204204

205-
tabbedParent.insertBefore(createElement('ul', 'tabbed-tabs', tabs), tabbedContainer)
205+
// insert a span into each tab, after the text content
206+
tabs.forEach(function (tab) {
207+
var span = createElement('span', 'ndl-tab-underline', [])
208+
tab.appendChild(span)
209+
})
210+
211+
tabbedParent.insertBefore(createElement('div', 'tabbed-tabs', tabs), tabbedContainer)
206212

207213
parent.removeChild(originalTab)
208214
})

0 commit comments

Comments
 (0)