Skip to content

Commit 66342eb

Browse files
ykmsdggdaltoso
andauthored
feat: add auth buttons (#56)
Co-authored-by: Gabriel Daltoso <ggdaltoso@gmail.com>
1 parent d8c5d5f commit 66342eb

File tree

6 files changed

+122
-1
lines changed

6 files changed

+122
-1
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<script setup lang="ts">
2+
defineProps<{ place: 'navScreen' | 'navBar' }>();
3+
</script>
4+
5+
<template>
6+
<div :class="place === 'navScreen' ? 'navScreenContainer' : 'navBarContainer'">
7+
<a href="https://stackblitz.com/sign_in" class="link light">Sign in</a>
8+
<a href="https://stackblitz.com/register" class="link accent">Get started</a>
9+
</div>
10+
</template>
11+
12+
<style scoped lang="scss">
13+
@import './linkStyles.scss';
14+
15+
/**
16+
* When we have enough space, we show auth buttons in nav bar.
17+
* When we don't, we show them inside the hamburger menu.
18+
*/
19+
.navBarContainer {
20+
margin-inline-start: 40px;
21+
display: flex;
22+
gap: 8px;
23+
// this is when we hide top nav menu
24+
@media screen and (max-width: 768px) {
25+
margin-inline-start: 0px;
26+
}
27+
@media screen and (max-width: 580px) {
28+
display: none;
29+
}
30+
31+
}
32+
33+
.navScreenContainer {
34+
display: none;
35+
@media screen and (max-width: 768px) {
36+
display: flex;
37+
gap: 8px;
38+
margin-block-start: 24px;
39+
}
40+
41+
.link {
42+
flex: 1;
43+
justify-content: center;
44+
height: 40px;
45+
}
46+
}
47+
</style>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<script setup lang="ts">
2+
import AuthButtons from './AuthButtons.vue';
3+
</script>
4+
5+
<template>
6+
<AuthButtons place="navBar" />
7+
</template>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<script setup lang="ts">
2+
import AuthButtons from './AuthButtons.vue';
3+
</script>
4+
5+
<template>
6+
<AuthButtons place="navScreen" />
7+
</template>
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
2+
.link {
3+
--outline-color-hsl: 0, 0%, 100%;
4+
--outline-opacity: 0.08;
5+
--text-strong-color: #fff;
6+
display: flex;
7+
align-items: center;
8+
height: 36px;
9+
padding: 0 20px;
10+
border-radius: 8px;
11+
color: var(--text-strong-color);
12+
font-size: 13px;
13+
font-weight: 500;
14+
text-decoration: none;
15+
box-shadow: inset 0 0 0 1px hsla(var(--outline-color-hsl), var(--outline-opacity));
16+
background-color: hsla(224, 32%, 28%, 0.24);
17+
backdrop-filter: blur(8px);
18+
transition: 0.1s ease;
19+
transition-property: background-color, box-shadow, color;
20+
}
21+
22+
.light {
23+
&:hover {
24+
--outline-opacity: 0.14;
25+
color: var(--text-strong-color);
26+
background-color: hsla(224, 32%, 28%, 0.54);
27+
}
28+
:root:not(.dark) & {
29+
--outline-color-hsl: 224, 32%, 28%;
30+
--outline-opacity: 0.1;
31+
color: hsl(240, 6%, 23%);
32+
background-color: hsla(224, 32%, 28%, 0.1);
33+
&:hover {
34+
--outline-opacity: 0.2;
35+
background-color: transparent;
36+
}
37+
}
38+
}
39+
40+
.accent {
41+
--outline-opacity: 0.14;
42+
color: var(--text-strong-color);
43+
background-color: hsl(214, 87%, 51%);
44+
&:hover {
45+
--outline-opacity: 0.24;
46+
background-color: hsl(208, 100%, 53%);
47+
}
48+
}
Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,26 @@
11
<script setup lang="ts">
22
import DefaultTheme from 'vitepress/theme';
33
import Feedback from './Feedback/Feedback.vue';
4+
import NavBarAuthButtons from './AuthButtons/NavBarAuthButtons.vue';
5+
import NavScreenAuthButtons from './AuthButtons/NavScreenAuthButtons.vue';
46
57
const { Layout } = DefaultTheme;
68
</script>
79

810
<template>
911
<Layout>
10-
12+
<template #nav-bar-content-after>
13+
<NavBarAuthButtons />
14+
</template>
1115
<!-- <template #layout-top>
1216
<ViteConfBanner />
1317
</template> -->
1418

1519
<template #doc-footer-before>
1620
<Feedback />
1721
</template>
22+
<template #nav-screen-content-after>
23+
<NavScreenAuthButtons />
24+
</template>
1825
</Layout>
1926
</template>

docs/.vitepress/theme/styles/fixes.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,11 @@ padding-top: 8px;
130130
}
131131
}
132132

133+
// Hide social links in the nav bar
134+
.VPSocialLinks.VPNavBarSocialLinks {
135+
display: none;
136+
}
137+
133138
// New body styles
134139
.vp-doc p,
135140
.vp-doc li {

0 commit comments

Comments
 (0)