Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add navbar #73

Merged
merged 32 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
41ac5fd
feat: add ai-assistant link
xiaowangxiaowang256256 Mar 5, 2024
a209c7d
fix: ordered UnoCSS attributes
xiaowangxiaowang256256 Mar 5, 2024
de788fb
fix: add @
xiaowangxiaowang256256 Mar 5, 2024
75b580d
fix: shrink icon
xiaowangxiaowang256256 Mar 5, 2024
cb50cf1
feat: add home button
xiaowangxiaowang256256 Mar 5, 2024
193ed5e
chore: remove @element-plus/icons-vue
xiaowangxiaowang256256 Mar 6, 2024
5379424
chore: remove element-plus
xiaowangxiaowang256256 Mar 6, 2024
91ce58d
chore: rollback this config
xiaowangxiaowang256256 Mar 6, 2024
a5575c3
feat: add a qrcode
xiaowangxiaowang256256 Mar 6, 2024
d210c84
fix: eslint fix
xiaowangxiaowang256256 Mar 6, 2024
b0e1aed
fix: describe error
xiaowangxiaowang256256 Mar 6, 2024
e44d661
fix: img alt description erro
xiaowangxiaowang256256 Mar 6, 2024
6c43863
refactor: ai assistant
sxzz Mar 6, 2024
5e71350
Merge branch 'opensource-f2f:main' into feat-nav
xiaowangxiaowang256256 Mar 7, 2024
6c43fea
chore: build navbar component
xiaowangxiaowang256256 Mar 7, 2024
8808da9
chore: navbar build
xiaowangxiaowang256256 Mar 8, 2024
1f99a84
Merge branch 'opensource-f2f:main' into main
xiaowangxiaowang256256 Mar 8, 2024
fb1df91
Merge branch 'main' of https://github.com/xiaowangxiaowang256256/webs…
xiaowangxiaowang256256 Mar 8, 2024
3f4baa5
fix: lint fix
xiaowangxiaowang256256 Mar 8, 2024
6315610
fix: image remove white pixels
xiaowangxiaowang256256 Mar 10, 2024
aa441d6
feat: add navbar
xiaowangxiaowang256256 Mar 10, 2024
665d6fa
Merge pull request #1 from xiaowangxiaowang256256/feat-nav
xiaowangxiaowang256256 Mar 10, 2024
e9dbe5e
fix: adjust the style format
xiaowangxiaowang256256 Mar 10, 2024
527ca9c
Merge pull request #2 from xiaowangxiaowang256256/feat-nav
xiaowangxiaowang256256 Mar 10, 2024
e3d4330
fix: page scroll display abnormal
xiaowangxiaowang256256 Mar 10, 2024
2579c66
fix: lint fix
xiaowangxiaowang256256 Mar 10, 2024
43d59a4
fix: add a pink heart icon for sponsor
xiaowangxiaowang256256 Mar 12, 2024
6977008
fix: use sm-hidden
xiaowangxiaowang256256 Mar 12, 2024
a93487e
fix: remove redundant strings
xiaowangxiaowang256256 Mar 12, 2024
8533600
fix: adapt to sm theme
xiaowangxiaowang256256 Mar 12, 2024
2843864
refactor
sxzz Mar 12, 2024
463b41e
chore: adjust table width
sxzz Mar 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified public/static/ai-assistant.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<script setup lang="ts">
import { useHead } from '@unhead/vue'
import { isShowMenu } from './utils/store-data'

useHead({
titleTemplate: (title) => (title ? `${title} | 开源面对面` : '开源面对面'),
Expand All @@ -9,7 +10,7 @@ useHead({
<template>
<app-header />
<ai-assistant />
<router-view v-slot="{ Component }">
<router-view v-show="!isShowMenu" v-slot="{ Component }">
sxzz marked this conversation as resolved.
Show resolved Hide resolved
<Transition>
<component :is="Component" />
</Transition>
Expand Down
3 changes: 0 additions & 3 deletions src/components/app-footer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@
Made by
<a href="https://github.com/sxzz" target="_blank">三咲智子</a> with ❤️
</p>
<p>
<a href="/sponsors" target="_blank">Our Sponsors</a>
</p>
<p>
<a href="https://github.com/opensource-f2f" target="_blank">开源面对面</a>
&copy; 2022
Expand Down
157 changes: 69 additions & 88 deletions src/components/app-header.vue
Original file line number Diff line number Diff line change
@@ -1,101 +1,82 @@
<script setup lang="ts">
import { Menu } from 'floating-vue'
import 'floating-vue/dist/style.css'

const isDark = useDark()
const toggleDark = useToggle(isDark)
</script>

<template>
<header
flex="~ row none"
relative
h-240px
w-full
justify-center
style="background: var(--header-bg)"
>
<div flex="~ col gap-16px" items-center justify-center>
<router-link :to="{ name: 'Index' }">
<img
h-100px
w-100px
rounded-2
src="/static/logo.png"
alt="开源面对面"
/>
</router-link>
<span>开源面对面,连接热爱开源的你!</span>

<div flex="~ row gap-2" flex-wrap justify-center>
<a target="_blank" href="https://github.com/opensource-f2f">
<img
alt="GitHub Org's stars"
src="https://img.shields.io/github/stars/opensource-f2f?style=social"
/>
</a>
<a target="_blank" href="https://twitter.com/osf2f">
<header style="background: var(--header-bg)">
<app-navbar />
<div flex="~ row none" relative h-240px w-full justify-center>
<div flex="~ col gap-16px" items-center justify-center>
<router-link :to="{ name: 'Index' }">
<img
alt="Twitter followers"
src="https://img.shields.io/twitter/follow/osf2f?style=social"
h-100px
w-100px
rounded-2
src="/static/logo.png"
alt="开源面对面"
/>
</a>
<a
target="_blank"
href="https://www.youtube.com/channel/UCV7Ibg1k_aMSEcDFgJvuvdg"
>
<img
alt="YouTube subscribers"
src="https://img.shields.io/youtube/channel/subscribers/UCV7Ibg1k_aMSEcDFgJvuvdg?style=social"
/>
</a>
<a target="_blank" href="https://feeds.osf2f.net/osf2f.xml">
<img
alt="RSS address"
src="https://img.shields.io/badge/rss-F88900?style=flat&logo=rss&logoColor=white"
/>
</a>
<a
target="_blank"
href="https://open.spotify.com/show/48Yeu1L5pTluk1AVc3ShU6"
>
<img
alt="Listen on Spotify"
src="https://img.shields.io/badge/spotify-1DB954?style=flat&logo=spotify&logoColor=white"
/>
</a>
<a target="_blank" href="https://music.163.com/#/djradio?id=1001312291">
<img h-20px alt="NetEase Music" src="/static/netease-music.svg" />
</a>
</router-link>
<span>开源面对面,连接热爱开源的你!</span>

<Menu>
<div text="#2aae67" i-carbon-logo-wechat cursor-pointer text-20px />
<template #popper>
<div flex="~ col" m-10px>
<img
h-150px
alt="Weixin Offcial Accounts Platform"
src="/static/we-chat.jpeg"
/>扫一扫 关注微信公众号
</div>
</template>
</Menu>
</div>
</div>
<div
absolute
right-5
top-5
cursor-pointer
i="dark:carbon-moon carbon-sun"
text="black 2xl"
@click="toggleDark()"
/>
<div flex="~ row gap-2" flex-wrap justify-center>
<a target="_blank" href="https://github.com/opensource-f2f">
<img
alt="GitHub Org's stars"
src="https://img.shields.io/github/stars/opensource-f2f?style=social"
/>
</a>
<a target="_blank" href="https://twitter.com/osf2f">
<img
alt="Twitter followers"
src="https://img.shields.io/twitter/follow/osf2f?style=social"
/>
</a>
<a
target="_blank"
href="https://www.youtube.com/channel/UCV7Ibg1k_aMSEcDFgJvuvdg"
>
<img
alt="YouTube subscribers"
src="https://img.shields.io/youtube/channel/subscribers/UCV7Ibg1k_aMSEcDFgJvuvdg?style=social"
/>
</a>
<a target="_blank" href="https://feeds.osf2f.net/osf2f.xml">
<img
alt="RSS address"
src="https://img.shields.io/badge/rss-F88900?style=flat&logo=rss&logoColor=white"
/>
</a>
<a
target="_blank"
href="https://open.spotify.com/show/48Yeu1L5pTluk1AVc3ShU6"
>
<img
alt="Listen on Spotify"
src="https://img.shields.io/badge/spotify-1DB954?style=flat&logo=spotify&logoColor=white"
/>
</a>
<a
target="_blank"
href="https://music.163.com/#/djradio?id=1001312291"
>
<img h-20px alt="NetEase Music" src="/static/netease-music.svg" />
</a>

<router-link to="/">
<div absolute left-5 top-5 cursor-pointer text="black 2xl">
<div i-carbon-home text="[var(--text-color)]" />
<Menu>
<div text="#2aae67" i-carbon-logo-wechat cursor-pointer text-20px />
<template #popper>
<div flex="~ col" m-10px>
<img
h-150px
alt="Weixin Offcial Accounts Platform"
src="/static/we-chat.jpeg"
/>扫一扫 关注微信公众号
</div>
</template>
</Menu>
</div>
</div>
</router-link>
</div>
</header>
</template>
48 changes: 48 additions & 0 deletions src/components/app-navbar.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<script setup lang="ts">
import { isLargeScreen } from '../utils/store-data'

const isDark = useDark()
const toggleDark = useToggle(isDark)
</script>

<template>
<div px-20px>
<div flex>
<!-- logo -->
<div h-60px flex items-center>
<router-link to="/">
<div cursor-pointer text="black 2xl">
<div i-carbon-home text="[var(--text-color)]" />
</div>
</router-link>
</div>

<div class="content" flex flex-grow-1 items-center flex-justify-end>
<!-- menu -->
<NavMenu v-if="isLargeScreen" class="menu" />

<!-- search -->
<!-- <NavSearch /> -->

<!-- theme-toggler -->
<div
ml-40px
cursor-pointer
i="dark:carbon-moon carbon-sun"
text="black 2xl"
@click="toggleDark()"
/>

<!-- github -->
<a target="_blank" href="https://github.com/opensource-f2f">
<div text="black 2xl" ml-15px cursor-pointer>
<div i-carbon-logo-github text="[var(--text-color)]" />
</div>
</a>

<!-- collapsible menu -->
<NavHamburger v-if="!isLargeScreen" />
</div>
</div>
</div>
</template>
45 changes: 45 additions & 0 deletions src/components/navbar/nav-hamburger.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<script setup lang="ts">
import { isShowMenu, menuList } from '../../utils/store-data'
</script>

<template>
<div
ml-20px
cursor-pointer
:i="isShowMenu ? 'carbon-close' : 'carbon-menu'"
text=" 2xl"
@click="isShowMenu = !isShowMenu"
/>
<div
v-if="isShowMenu"
style="background-color: var(--bg)"
flex="~ col"
fixed
left-0
top-60px
z-999
h-full
w-full
px-50px
py-10px
>
<div
v-for="(item, key) in menuList"
:key="key"
style="border-bottom: 1px solid var(--border-color)"
border-bottom="1px solid [var(--border-color)]"
p-10px
text-center
>
<a
:key="key"
ml-20px
style="color: var(--text-color)"
:item="item"
:href="item.href"
>
{{ item.name }}
</a>
</div>
</div>
</template>
18 changes: 18 additions & 0 deletions src/components/navbar/nav-menu.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<script setup lang="ts">
import { menuList } from '../../utils/store-data'
</script>

<template>
<nav flex>
<a
v-for="(item, key) in menuList"
:key="key"
ml-20px
style="color: var(--text-color)"
:item="item"
:href="item.href"
>
{{ item.name }}
</a>
</nav>
</template>
5 changes: 5 additions & 0 deletions src/components/navbar/nav-search.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<script setup lang="ts"></script>

<template>
<div>search</div>
</template>
5 changes: 3 additions & 2 deletions src/components/sponsors.vue
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
<script setup lang="ts">
import sponsors from '../assets/sponsors.json'
import { isLargeScreen } from '../utils/store-data'

sponsors.sort((a, b) => {
return Date.parse(b.date) - Date.parse(a.date)
})
</script>

<template>
<div style="align-self: center">
<div self-center>
<div>Sponsor list</div>

<table style="width: 600px">
<table :style="{ width: isLargeScreen ? '600px' : '350px' }">
sxzz marked this conversation as resolved.
Show resolved Hide resolved
<tr>
<td>捐赠人</td>
<td>时间</td>
Expand Down
4 changes: 4 additions & 0 deletions src/typings/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,16 @@ declare module 'vue' {
AiAssistant: typeof import('./../components/ai-assistant.vue')['default']
AppFooter: typeof import('./../components/app-footer.vue')['default']
AppHeader: typeof import('./../components/app-header.vue')['default']
AppNavbar: typeof import('./../components/app-navbar.vue')['default']
Badge: typeof import('./../components/badge.vue')['default']
Components: typeof import('./../components/index.vue')['default']
ContributorContent: typeof import('./../components/contributor-content.vue')['default']
EpisodeContent: typeof import('./../components/episode-content.vue')['default']
EpisodeItem: typeof import('./../components/episode-item.vue')['default']
EpisodeMeta: typeof import('./../components/episode-meta.vue')['default']
NavHamburger: typeof import('./../components/navbar/nav-hamburger.vue')['default']
NavMenu: typeof import('./../components/navbar/nav-menu.vue')['default']
NavSearch: typeof import('./../components/navbar/nav-search.vue')['default']
NotFound: typeof import('./../components/not-found.vue')['default']
Person: typeof import('./../components/person.vue')['default']
PersonList: typeof import('./../components/person-list.vue')['default']
Expand Down
8 changes: 8 additions & 0 deletions src/utils/store-data.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/** menuList info */
export const menuList = ref([{ name: 'Sponsors', href: '/sponsors' }])

/** isLargeScreen info */
export const isLargeScreen = useMediaQuery('(min-width: 600px)')

/** isShowMenu */
export const isShowMenu = ref(false)
Loading