Skip to content

Commit

Permalink
fix: icons positioning (#722)
Browse files Browse the repository at this point in the history
* fix: move icons from header to footer; some cleanup

* cleanup

* update positioning after feedback

* add TODO comment back

* Update pnpm-lock.yaml

Co-authored-by: Sébastien Chopin <seb@nuxtjs.com>
  • Loading branch information
bdrtsky and Atinux committed Dec 16, 2022
1 parent cbd21b9 commit 7168e19
Show file tree
Hide file tree
Showing 11 changed files with 157 additions and 467 deletions.
63 changes: 36 additions & 27 deletions components/app/AppFooter.vue
Expand Up @@ -15,33 +15,30 @@ const nbSocialIcons = computed(() => (socialIcons.value ? socialIconsCount.value
<p>{{ docus.footer.credits.text }}</p>
</a>
<!-- Right -->
<div class="right">
<a
v-for="icon in icons.slice(0, 6 - nbSocialIcons)"
:key="icon.label"
rel="noopener"
:aria-label="icon.label"
:href="icon.href"
target="_blank"
>
<!-- Center -->
<div class="center">
<a v-for="icon in icons.slice(0, 6 - nbSocialIcons)" :key="icon.label" rel="noopener" :aria-label="icon.label"
:href="icon.href" target="_blank">
<Icon :name="icon.icon || icon.component" />
</a>
<AppSocialIcons ref="socialIcons" />
</div>
</Container>
</footer>
</template>
<style lang="ts" scoped>
css({
footer: {
height: '{docus.footer.height}',
display: 'flex',
alignItems: 'center',
borderTopWidth: '1px',
borderTopStyle: 'solid',
borderTopColor: '{color.gray.100}',
padding: '{docus.footer.padding}',
'@dark': {
borderTopColor: '{color.gray.900}'
},
':deep(.icon)': {
width: '{space.4}',
Expand All @@ -61,40 +58,52 @@ css({
},
},
'@dark': {
borderTopColor: '{color.gray.900}'
},
'.left': {
display: 'flex',
alignItems: 'center',
p: {
fontSize: '{fontSize.xs}',
fontWeight: '{fontWeight.bold}'
},
'&-icon': {
width: '{space.4}',
fill: 'currentcolor',
marginRight: '{space.2}',
}
},
'.right': {
'.center': {
display: 'flex',
alignItems: 'center',
gap: '{space.4}'
},
'.footer-container': {
display: 'flex',
flexDirection: 'col',
alignItems: 'center',
height: '100%',
gap: '{space.4}',
flexDirection: 'row',
justifyContent: 'space-between',
display: 'grid',
gridTemplateColumns: 'repeat(12, minmax(0, 1fr))',
justifyItems: 'center',
gap: '{space.2}',
'@sm': {
justifyItems: 'legacy',
},
'.left': {
gridColumn: 'span 12 / span 12',
'@sm': {
gridColumn: 'span 4 / span 4'
}
},
'.center': {
display: 'flex',
justifyContent: 'center',
gridColumn: 'span 12 / span 12',
'@sm': {
gridColumn: 'span 4 / span 4'
},
a: {
display: 'flex'
}
},
}
}
})
Expand Down
28 changes: 19 additions & 9 deletions components/app/AppHeader.vue
Expand Up @@ -7,21 +7,23 @@ const hasDialog = computed(() => navigation.value?.length > 1)
<template>
<header :class="{ 'has-dialog': hasDialog, 'has-doc-search': hasDocSearch }">
<Container>
<section class="left">
<div class="section left">
<AppHeaderDialog v-if="hasDialog" />
<AppHeaderLogo />
</section>
</div>

<section class="center">
<div class="section center">
<AppHeaderLogo v-if="hasDialog" />
<AppHeaderNavigation />
</section>
</div>

<section class="right">
<AppSearch v-if="hasDocSearch" />
<div class="section right">
<AppSearch v-if="hasDocSearch"/>
<ThemeSelect />
<AppSocialIcons />
</section>
<div class="social-icons">
<AppSocialIcons />
</div>
</div>
</Container>
</header>
</template>
Expand Down Expand Up @@ -71,7 +73,7 @@ css({
gap: '2rem'
},
section: {
'.section': {
display: 'flex',
alignItems: 'center',
flex: 'none',
Expand All @@ -90,6 +92,14 @@ css({
alignItems: 'center',
flex: 'none',
gap: '{space.4}',
'.social-icons': {
display: 'none',
'@md': {
display: 'flex',
alignItems: 'center',
gap: '{space.4}'
}
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion components/app/AppHeaderDialog.vue
Expand Up @@ -33,8 +33,8 @@ watch(visible, v => (v ? open() : close()))
</button>

<div class="icons">
<AppSocialIcons />
<ThemeSelect />
<AppSocialIcons />
</div>
</div>

Expand Down
2 changes: 1 addition & 1 deletion components/app/AppHeaderNavigation.vue
Expand Up @@ -19,7 +19,7 @@ const isActive = (link: any) => (link.exact ? route.fullPath === link._path : ro
</script>

<template>
<nav>
<nav v-if="hasNavigation">
<ul>
<li
v-for="link in tree"
Expand Down
9 changes: 2 additions & 7 deletions components/app/AppSearch.vue
Expand Up @@ -32,7 +32,6 @@ css({
borderRadius: '{radii.md}',
display: 'flex',
alignItems: 'center',
fontSize: '{fontSize.sm}',
color: '{color.gray.500}',
borderStyle: 'solid',
borderWidth: '1px',
Expand All @@ -55,20 +54,16 @@ css({
},
span: {
'&:first-child': {
// hidden text-xs font-medium lg:block
display: 'none',
display: 'block',
fontSize: '{fontSize.xs}',
fontWeight: '{fontWeight.medium}',
'@lg': {
display: 'block'
}
},
'&:nth-child(2)': {
flex: 'none',
display: 'none',
fontSize: '{fontSize.xs}',
fontWeight: '{fontWeight.semibold}',
'@lg': {
'@sm': {
display: 'block'
}
}
Expand Down
1 change: 1 addition & 0 deletions components/app/AppSocialIcons.vue
Expand Up @@ -39,6 +39,7 @@ const icons = computed<any>(() => {
<style lang="ts" scoped>
css({
a: {
display: 'flex',
color: '{color.gray.500}',
'@dark': {
Expand Down
2 changes: 1 addition & 1 deletion components/app/ThemeSelect.vue
Expand Up @@ -22,7 +22,7 @@ const onClick = () => {
<style lang="ts" scoped>
css({
button: {
display: 'inline-block',
display: 'flex',
color: '{color.gray.500}',
'@dark': {
Expand Down
4 changes: 1 addition & 3 deletions components/docs/DocsPageContent.vue
Expand Up @@ -110,8 +110,7 @@ css({
'.docs-page-content': {
position: 'relative',
display: 'flex',
flexDirection: 'column-reverse',
minHeight: '{docus.page.height}',
flexDirection: 'column',
'@lg': {
display: 'grid',
gap: '{space.8}',
Expand Down Expand Up @@ -210,7 +209,6 @@ css({
mx: 'calc(0px - {space.6})',
},
'@lg': {
maxHeight: '{docus.page.height}',
gridColumn: 'span 2 / span 2',
mx: 0,
alignSelf: 'flex-start',
Expand Down
1 change: 0 additions & 1 deletion layouts/page.vue
Expand Up @@ -17,7 +17,6 @@ css({
'.page-layout': {
display: 'flex',
flexDirection: 'column',
minHeight: '{docus.page.height}',
position: 'relative'
}
})
Expand Down

1 comment on commit 7168e19

@vercel
Copy link

@vercel vercel bot commented on 7168e19 Dec 16, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.