Made the tabs look better
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
Gregory Ballantine 2022-10-29 01:14:08 -04:00
parent c878447c45
commit ae155b2d7e
5 changed files with 56 additions and 10 deletions

View File

@ -9,7 +9,6 @@ window.addEventListener('load', () ->
document.getElementById('cpuThreads').innerText = data.cores document.getElementById('cpuThreads').innerText = data.cores
document.getElementById('cpuClockBase').innerText = data.speed document.getElementById('cpuClockBase').innerText = data.speed
document.getElementById('cpuClockBoost').innerText = data.speedMax document.getElementById('cpuClockBoost').innerText = data.speedMax
console.log(data)
).catch((error) -> ).catch((error) ->
console.error(error) console.error(error)
) )

View File

@ -23,7 +23,6 @@ loadGpus = () ->
optionElem.setAttribute('value', i) optionElem.setAttribute('value', i)
document.getElementById('gpuSelector').appendChild(optionElem) document.getElementById('gpuSelector').appendChild(optionElem)
i++ i++
console.log(data)
).catch((error) -> ).catch((error) ->
console.error(error) console.error(error)
) )

View File

@ -1,11 +1,15 @@
@openTab = (tab) -> @openTab = (tab) ->
# show the component info that's selected
tabs = document.querySelectorAll('.tab-button')
displays = document.querySelectorAll('.component-display') displays = document.querySelectorAll('.component-display')
i = 0 i = 0
while i < displays.length while i < displays.length
if displays[i].getAttribute('data-component') == tab if displays[i].getAttribute('data-component') == tab
displays[i].classList.add('active') displays[i].classList.add('active')
tabs[i].classList.add('active')
else else
displays[i].classList.remove('active') displays[i].classList.remove('active')
tabs[i].classList.remove('active')
i++ i++
@formatBytes = (bytes, decimals = 2) -> @formatBytes = (bytes, decimals = 2) ->

View File

@ -1,4 +1,8 @@
$tab-bar-height: 50px
body body
margin: 0
padding: $tab-bar-height 0 0
background: white background: white
font-size: 18px font-size: 18px
@ -33,6 +37,42 @@ button
.container.fluid .container.fluid
max-width: 100% max-width: 100%
margin: 0
#wrapper
margin-top: 25px
#tab-bar
position: fixed
top: 0
left: 0
z-index: 10
width: 100%
height: $tab-bar-height
margin: 0
padding: 0
background: #eee
border-bottom: 1px solid #bbb
box-shadow: 0 1px 2px rgba(0, 0, 0, .25)
.row
display: relative
.tab-button
float: left
height: 50px
margin: 0
background-color: #eee
border: none
border-right: 1px solid #999
border-radius: 0
color: #212121
font-size: 2rem
font-weight: bold
transition: all 230ms ease-in-out
&.active
background-color: white
.component-display .component-display
display: none display: none

View File

@ -14,17 +14,21 @@
<script src="./js/gpu.js"></script> <script src="./js/gpu.js"></script>
</head> </head>
<body> <body>
<div class="container fluid">
<!-- tab buttons --> <!-- tab buttons -->
<div id="tab-bar">
<div class="container fluid">
<div class="row"> <div class="row">
<div class="columns twelve"> <div class="columns twelve">
<button class="tab-button" onclick="openTab('cpu')">CPU</button> <button class="tab-button active" onclick="openTab('cpu')">CPU</button>
<button class="tab-button" onclick="openTab('memory')">Memory</button> <button class="tab-button" onclick="openTab('memory')">Memory</button>
<button class="tab-button" onclick="openTab('storage')">Storage</button> <button class="tab-button" onclick="openTab('storage')">Storage</button>
<button class="tab-button" onclick="openTab('gpu')">GPU</button> <button class="tab-button" onclick="openTab('gpu')">GPU</button>
</div> </div>
</div> </div>
</div>
</div>
<div id="wrapper" class="container">
<div class="component-display active" data-component="cpu"> <div class="component-display active" data-component="cpu">
{% include 'cpu.twig' %} {% include 'cpu.twig' %}
</div> </div>