Skip to content

Commit 7025a17

Browse files
committed
Add vertical tabs
1 parent dc10c2a commit 7025a17

File tree

4 files changed

+64
-14
lines changed

4 files changed

+64
-14
lines changed

resources/assets/scss/component.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
@import 'component/block';
22
@import 'component/timeline';
3-
// @import "component/card";
3+
@import "component/card";
44

55
.btn-select {
66
display: block;
Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,30 @@
1-
.card-tabs {
2-
.card-header {
3-
background-color: #cccccc;
4-
border-top: #888888 1px solid;
5-
border-left: #888888 1px solid;
1+
.card-tabs-vertical {
2+
display: flex;
3+
4+
.card-header-vertical {
5+
background-color: rgba(0, 0, 0, 0.1);
66
border-right: #888888 1px solid;
7-
}
87

9-
.card-header-tabs {
10-
.nav-link {
11-
color: black;
12-
}
13-
.nav-link.active {
14-
color: black;
8+
.nav-pills {
9+
.nav-item {
10+
.nav-link {
11+
border-bottom: $card-border-width solid $card-border-color;
12+
border-radius: 0;
13+
color: #000000;
14+
border-color: rgba(0, 100, 118, 0.6);
15+
16+
&.active {
17+
background-color: #FFFFFF;
18+
border-right: $card-border-width solid #ffffff;
19+
margin-right: -1px;
20+
}
21+
}
22+
}
1523
}
1624
}
25+
26+
.tab-content {
27+
border: 0;
28+
border-radius: 0;
29+
}
1730
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
@php
2+
$id = $id ?? 'tabs-' . mt_rand(0, 9999999999);
3+
@endphp
4+
<div class="card card-tabs-vertical {{ $class ?? '' }}" id="{{ $id }}"
5+
@isset($style) style="{{ $style }}" @endisset
6+
>
7+
<div class="row no-gutters">
8+
<div class="col-2 card-header-vertical">
9+
<ul class="nav flex-column nav-pills" role="tablist">
10+
@foreach($tabs as $tabId => $tabLabel)
11+
<li class="nav-item">
12+
<a class="nav-link @if($loop->first) active @endif"
13+
id="{{ $tabId }}-tab"
14+
data-toggle="pill"
15+
href="#{{ $tabId }}"
16+
role="tab"
17+
aria-controls="{{ $tabId }}"
18+
aria-expanded="true"
19+
>{!! $tabLabel !!}</a>
20+
</li>
21+
@endforeach
22+
</ul>
23+
</div>
24+
<div class="col-10 px-3 {{ $bodyClass ?? '' }} tab-content card-body">
25+
{{ $slot }}
26+
</div>
27+
</div>
28+
</div>
29+
<script>
30+
(function () {
31+
var tabs = document.querySelectorAll('#{{ $id }} .tab-pane:not(:first-child)')
32+
for (var i = 0; i < tabs.length; i++) {
33+
tabs[i].classList.remove('active')
34+
tabs[i].classList.remove('show')
35+
}
36+
})()
37+
</script>

resources/views/tabs.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<div class="card card-tabs {{ $class ?? '' }}" id="{{ $id }}"
55
@isset($style) style="{{ $style }}" @endisset
66
>
7-
<div class="card-header ">
7+
<div class="card-header">
88
<ul class="nav nav-tabs card-header-tabs" role="tablist">
99
@foreach($tabs as $tabId => $tabLabel)
1010
<li class="nav-item">

0 commit comments

Comments
 (0)