Skip to content

Commit

Permalink
feat: create a button top
Browse files Browse the repository at this point in the history
  • Loading branch information
esterfania committed Oct 18, 2024
1 parent 5010acd commit 92a3046
Show file tree
Hide file tree
Showing 5 changed files with 172 additions and 76 deletions.
14 changes: 14 additions & 0 deletions assets/css/button_up.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions assets/css/button_up.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions assets/js/scrollToTop.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
const button = document.querySelector(".button-up");

const showButtonIfScroll = () => {
if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) {
button.style.display = "block";
} else {
button.style.display = "none";
}
};

const scrollToTop = () => {
window.scrollTo({
top: 0,
behavior: "smooth",
});
};

button.addEventListener("click", scrollToTop);
window.onscroll = () => showButtonIfScroll();
13 changes: 13 additions & 0 deletions assets/sass/button_up.sass
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
@import "variables"

.button-up
background-color: $primary-500
color: $white
border: none
border-radius: 5px
padding: 10px 20px
cursor: pointer
position: fixed
top: 90%
right: 20px
display: none
201 changes: 125 additions & 76 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,89 +1,138 @@
<!DOCTYPE html>
<html lang="pt-BR">
<head>
<!-- Meta settings -->
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta
name="description"
content="Um dicionário tech para pessoas que querem aprender mais sobre termos técnicos dentro da tecnologia!"
/>

<head>
<!-- Meta settings -->
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description"
content="Um dicionário tech para pessoas que querem aprender mais sobre termos técnicos dentro da tecnologia!" />
<!-- Favicon -->
<link
rel="shortcut icon"
href="/assets/img/brand/symbol/colored.ico"
type="image/x-icon"
/>

<!-- Favicon -->
<link rel="shortcut icon" href="/assets/img/brand/symbol/colored.ico" type="image/x-icon" />
<!-- CSS Imports -->
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link rel="stylesheet" href="assets/css/style.css" />
<link rel="stylesheet" href="assets/css/cookies.css" />
<link rel="stylesheet" href="assets/css/dark_mode.css" />
<link rel="stylesheet" href="assets/css/button_up.css" />

<!-- CSS Imports -->
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link rel="stylesheet" href="assets/css/style.css" />
<link rel="stylesheet" href="assets/css/cookies.css">
<link rel="stylesheet" href="assets/css/dark_mode.css">
<!-- Phosphor Icons -->
<script src="https://unpkg.com/@phosphor-icons/web"></script>

<!-- Phosphor Icons -->
<script src="https://unpkg.com/@phosphor-icons/web"></script>
<!-- Analytics -->
<script
data-goatcounter="https://levxyca.goatcounter.com/count"
async
src="//gc.zgo.at/count.js"
></script>

<!-- Analytics -->
<script data-goatcounter="https://levxyca.goatcounter.com/count" async src="//gc.zgo.at/count.js"></script>
<title>Diciotech</title>
</head>

<title>Diciotech</title>
</head>

<body>
<header class="header">
<a href="https://github.com/levxyca/diciotech" target="_blank" class="github-corner"
aria-label="Visualizar projeto no GitHub"><svg viewBox="0 0 250 250" aria-hidden="true">
<path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path>
<path
d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2"
fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path>
<path
d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z"
fill="currentColor" class="octo-body"></path>
</svg></a>
<h1 class="header__title">
<img src="/assets/img/brand/logo/colored.png" width="480" height="148" alt="Diciotech" />
</h1>
<h2 class="header__subtitle">
Um dicionário tech para pessoas que querem aprender mais sobre termos
técnicos dentro da tecnologia 📖
</h2>

<button id="dark-mode-toggle" class="button-dark-mode" title="Mudar tema">
<i class="ph ph-moon"></i>
<i class="ph ph-sun"></i>
</button>
</header>
<main class="main">
<div class="search">
<div class="searchbar">
<svg xmlns="http://www.w3.org/2000/svg" class="searchbar__icon" viewBox="0 0 16 16">
<body>
<header class="header">
<a
href="https://github.com/levxyca/diciotech"
target="_blank"
class="github-corner"
aria-label="Visualizar projeto no GitHub"
><svg viewBox="0 0 250 250" aria-hidden="true">
<path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path>
<path
d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z" />
d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2"
fill="currentColor"
style="transform-origin: 130px 106px"
class="octo-arm"
></path>
<path
d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z"
fill="currentColor"
class="octo-body"
></path>
</svg>
<input id="search-input" type="text" name="search-input" placeholder="Pesquisar..." class="searchbar__input" />
</div>
<div class="filter">
<label for="tags-filter" class="filter_label">Filtrar por categoria:</label>
<select id="tags-filter">
<option value="Todos" selected>Todos</option>
</select>
</a>
<h1 class="header__title">
<img
src="/assets/img/brand/logo/colored.png"
width="480"
height="148"
alt="Diciotech"
/>
</h1>
<h2 class="header__subtitle">
Um dicionário tech para pessoas que querem aprender mais sobre termos
técnicos dentro da tecnologia 📖
</h2>

<button id="dark-mode-toggle" class="button-dark-mode" title="Mudar tema">
<i class="ph ph-moon"></i>
<i class="ph ph-sun"></i>
</button>
</header>
<main class="main">
<div class="search">
<div class="searchbar">
<svg
xmlns="http://www.w3.org/2000/svg"
class="searchbar__icon"
viewBox="0 0 16 16"
>
<path
d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z"
/>
</svg>
<input
id="search-input"
type="text"
name="search-input"
placeholder="Pesquisar..."
class="searchbar__input"
/>
</div>
<div class="filter">
<label for="tags-filter" class="filter_label"
>Filtrar por categoria:</label
>
<select id="tags-filter">
<option value="Todos" selected>Todos</option>
</select>
</div>
</div>
</div>
<section class="cards" id="cards"></section>
<div class="cookies-container">
<div class="cookies-content">
<p class="cookies-message">O Diciotech usa cookies para garantir que você obtenha uma melhor experiência.
Desativar os cookies do site pode prejudicar a funcionalidade de alguns recursos e ao continuar usando, você
concorda com a nossa Política de Cookies. <a
href="https://cookie-consent.app.forthe.top/why-websites-use-cookies/" target="_blank">Ler mais</a></p>
<div class="cookies-buttons">
<button class="cookies-accept-button">Concordar e fechar</button>
<section class="cards" id="cards"></section>
<div class="cookies-container">
<div class="cookies-content">
<p class="cookies-message">
O Diciotech usa cookies para garantir que você obtenha uma melhor
experiência. Desativar os cookies do site pode prejudicar a
funcionalidade de alguns recursos e ao continuar usando, você
concorda com a nossa Política de Cookies.
<a
href="https://cookie-consent.app.forthe.top/why-websites-use-cookies/"
target="_blank"
>Ler mais
</a>
</p>
<div class="cookies-buttons">
<button class="cookies-accept-button">Concordar e fechar</button>
</div>
</div>
</div>
</div>
</main>
<script src="assets/js/script.js" type="module"></script>
<script src="assets/js/cookies.js" type="module"></script>
</body>

</html>
<button class="button-up">
Up
<i class="ph ph-arrow-up"></i>
</button>
</main>
<script src="assets/js/script.js" type="module"></script>
<script src="assets/js/cookies.js" type="module"></script>
<script src="assets/js/scrollToTop.js" type="module"></script>
</body>
</html>

0 comments on commit 92a3046

Please sign in to comment.