import { defineComponent, computed } from 'vue'
-import { useState } from '@/hooks'
+import { useState, useResizeObserver, useElementRef } from '@/hooks'
import gravatar from '@/utils/gravatar'
export default defineComponent({
@@ -31,6 +31,7 @@ export default defineComponent({
avatar: { type: Boolean, default: false },
alt: String,
draggable: { type: Boolean, default: false },
+ ratio: { type: Number, default: NaN },
},
setup(props, { emit }) {
const [state, setState] = useState('loading')
@@ -53,11 +54,24 @@ export default defineComponent({
emit('load', event)
}
+ const [containerRef, setContainerRef] = useElementRef()
+ const containerSize = useResizeObserver(containerRef)
+
+ const imageHeight = computed(() => {
+ if (!isNaN(props.ratio) && props.ratio >= 0) {
+ return `${containerSize.value.width * props.ratio}px`
+ } else {
+ return '100%'
+ }
+ })
+
return {
placeholderImage,
handleError,
handleLoad,
state,
+ setContainerRef,
+ imageHeight,
}
},
})
diff --git a/src/components/link/Link.vue b/src/components/link/Link.vue
index 0533b04..ec24ef2 100644
--- a/src/components/link/Link.vue
+++ b/src/components/link/Link.vue
@@ -5,9 +5,12 @@
-
+
+
+
+
diff --git a/src/layouts/components/header/Header.vue b/src/layouts/components/header/Header.vue
index 6319ccc..fb4ca79 100644
--- a/src/layouts/components/header/Header.vue
+++ b/src/layouts/components/header/Header.vue
@@ -2,13 +2,19 @@
@@ -87,9 +118,10 @@ import { init } from '@/store'
import sakuraOptions from '@/utils/sakuraOptions'
import camelcaseKeys from 'camelcase-keys'
import NavItem from '@/layouts/components/header/NavItem.vue'
+import Ripple from '@/components/ripple/Ripple.vue'
export default defineComponent({
- components: { NavItem },
+ components: { NavItem, Ripple },
setup() {
const avatar = 'https://view.moezx.cc/images/2021/06/13/d6b010a378d392d4633008b915f98ab1.md.png'
const logo = sakuraOptions['basic.site.logo'][0]?.url || 'https://v3.vuejs.org/logo.png'
@@ -142,6 +174,33 @@ export default defineComponent({
return items
})
+ const unsignedOptions = [
+ { title: 'Register', icon: 'fas fa-user-plus', url: '' },
+ { title: 'Sign in', icon: 'fas fa-sign-out-alt', url: '' },
+ ]
+ const loginedOptions = [
+ { title: 'User Center', icon: 'fas fa-user', url: '' },
+ { title: 'Sign out', icon: 'fas fa-sign-out-alt', url: '' },
+ ]
+ const languageOptions = [
+ {
+ title: 'Language',
+ icon: 'fas fa-globe',
+ url: '',
+ child: [
+ { title: '简体中文', value: 'zh-CN' },
+ { title: '繁體中文', value: 'zh-HK' },
+ { title: 'English', value: 'en' },
+ { title: 'Español', value: 'es' },
+ { title: 'Deutsch', value: 'de' },
+ { title: 'Français', value: 'fr' },
+ { title: 'Русский', value: 'ru' },
+ { title: '日本語', value: 'ja' },
+ ],
+ },
+ ]
+ const logined = ref(true)
+
return {
navItems,
setNavBarWrapperRef,
@@ -153,6 +212,10 @@ export default defineComponent({
logo,
initState,
useMDCRipple,
+ logined,
+ loginedOptions,
+ unsignedOptions,
+ languageOptions,
}
},
})
@@ -168,17 +231,23 @@ export default defineComponent({
align-items: center;
background: #ffffff;
> .header__content {
- width: calc(100% - 48px);
+ // width: calc(100% - 48px);
+ width: 100%;
height: 48px;
display: flex;
flex-flow: row nowrap;
> .logo__wrapper {
flex: 0 0 auto;
- display: flex;
- justify-content: center;
- align-items: center;
- > .logo {
- height: 32px;
+ height: 100%;
+ .logo__container {
+ height: 100%;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ .logo {
+ height: 32px;
+ padding: 0 24px;
+ }
}
}
> .nav__wrapper {
@@ -186,7 +255,7 @@ export default defineComponent({
width: 100%;
display: flex;
flex-flow: row nowrap;
- padding: 0 24px;
+ // padding: 0 24px;
.nav__ul {
&.hide {
position: absolute;
@@ -309,14 +378,85 @@ export default defineComponent({
> .profile__wrapper {
flex: 0 0 auto;
- display: flex;
- justify-content: center;
- align-items: center;
- > .avatar {
- height: 32px;
- width: 32px;
- object-fit: cover;
- border-radius: 50%;
+ height: 100%;
+ position: relative;
+ .image__wrapper {
+ height: 100%;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ padding: 0 24px;
+ > .avatar {
+ height: 32px;
+ width: 32px;
+ object-fit: cover;
+ border-radius: 50%;
+ }
+ }
+ .drop-down__wrapper {
+ position: absolute;
+ top: 48px;
+ right: 0;
+ width: auto;
+ z-index: -1;
+ pointer-events: none;
+ visibility: hidden;
+ transform: translate(0, -100%);
+ // pointer-events: all;
+ // cursor: pointer;
+ // visibility: visible;
+ // transform: translate(0, 0%);
+ transition: all 0.2s ease-in-out;
+ .ul {
+ position: relative;
+ padding: 16px 0;
+ background: #ffffff;
+ border-radius: 0 0 5px 5px;
+ > .li {
+ height: 48px;
+ display: flex;
+ flex-flow: row nowrap;
+ justify-content: flex-start;
+ align-items: center;
+ position: relative;
+ > .child__ul {
+ position: absolute;
+ top: 0;
+ left: 0;
+ z-index: -1;
+ padding: 16px 0;
+ transform: translate(-100%, -16px) scale(0, 0);
+ transform-origin: right (16px + math.div(48px, 2));
+ background: #ffffff;
+ border-radius: 5px;
+ width: auto;
+ transition: all 0.2s ease-in-out;
+ > .child__li {
+ height: 48px;
+ display: flex;
+ flex-flow: row nowrap;
+ justify-content: flex-start;
+ align-items: center;
+ }
+ }
+ &:hover {
+ > .child__ul {
+ transform: translate(-100%, -16px) scale(1, 1);
+ }
+ }
+ }
+ }
+ ::v-deep() {
+ .link__container .nav-item__container .nav-item__content {
+ justify-content: flex-start;
+ }
+ }
+ }
+ &:hover .drop-down__wrapper {
+ pointer-events: all;
+ cursor: pointer;
+ visibility: visible;
+ transform: translate(0, 0%);
}
}
}
diff --git a/src/locales/default.json b/src/locales/default.json
index b0dec20..058f914 100644
--- a/src/locales/default.json
+++ b/src/locales/default.json
@@ -10,7 +10,13 @@
"messages.admin.uplicateUrls": "Duplicate URLs",
"messages.comment.submit.error": "Comment post failure.",
"messages.comment.submit.success": "Comment post successfully.",
+ "messages.commentList.cache.updateError": "Opps! Something went wrong when updating comment list.",
+ "messages.commentList.cache.updateSuccess": "Comment list updated.",
+ "messages.commentList.cache.updating": "Updating the latest comment list...",
+ "messages.commentList.title.commentCount": "{commentCount, plural, =0 {Be the first one to leave a comment!} =1 {One comment} other {{commentCount, number, ::compact-short} Comments}}",
+ "messages.commentList.title.heading": "Comments",
"messages.commonMessages.javascriptErrorTitle": "Opps, something when wrong!",
+ "messages.content.status.errorLoadingComponent": "Something went wrong when loading this component.",
"messages.popup.close": "Close",
"messages.popup.dismiss": "Dismiss",
"messages.popup.showDetails": "Show details",
@@ -69,8 +75,21 @@
"posts.comment.composer.authorUrl.label": "Link",
"posts.comment.composer.captcha.toggleButton": "Captcha",
"posts.comment.composer.content.label": "You are a surprise that I will only meet once in my life",
+ "posts.comment.composer.privacy.anynomous.negative": "Autonym",
+ "posts.comment.composer.privacy.anynomous.positive": "Anynomous",
+ "posts.comment.composer.privacy.anynomous.title": "Whether to comment as an anynomous user?",
+ "posts.comment.composer.privacy.subscribe.negative": "Unsubscribe",
+ "posts.comment.composer.privacy.subscribe.positive": "Subscribe",
+ "posts.comment.composer.privacy.subscribe.title": "Whether to inform you with email when receiving reply?",
+ "posts.comment.composer.privacy.visibility.negative": "Public",
+ "posts.comment.composer.privacy.visibility.positive": "Secret",
+ "posts.comment.composer.privacy.visibility.title": "Whether to create secret comment that only admins and peoples mentioned can see?",
"posts.comment.composer.submit.button": "Submit",
- "posts.comment.composer.tips.markdownSupported": "Markdown Supported",
+ "posts.comment.composer.toolkits.emoji.tooltip": "Insert emoji",
+ "posts.comment.composer.toolkits.image.tooltip": "Attach image",
+ "posts.comment.composer.toolkits.markdown.tooltip": "'
Markdown' supported",
+ "posts.comment.composer.toolkits.preview.tooltip": "'
' Markdown preview",
+ "posts.comment.composer.toolkits.privacy.tooltip": "Privacy settings",
"posts.commentCount": "{commentCount, plural, =0 {No comment} =1 {One comment} other {{commentCount, number, ::compact-short} Comments}}",
"posts.postTimeOn.brief": "{publistTimeDate, date, long}",
"posts.postTimeOn.full": "Post on {publistTimeDate, date, long}",
diff --git a/src/locales/defaultMessages.json b/src/locales/defaultMessages.json
index 469240a..5db450c 100644
--- a/src/locales/defaultMessages.json
+++ b/src/locales/defaultMessages.json
@@ -32,9 +32,27 @@
"messages.comment.submit.success": {
"defaultMessage": "Comment post successfully."
},
+ "messages.commentList.cache.updateError": {
+ "defaultMessage": "Opps! Something went wrong when updating comment list."
+ },
+ "messages.commentList.cache.updateSuccess": {
+ "defaultMessage": "Comment list updated."
+ },
+ "messages.commentList.cache.updating": {
+ "defaultMessage": "Updating the latest comment list..."
+ },
+ "messages.commentList.title.commentCount": {
+ "defaultMessage": "{commentCount, plural, =0 {Be the first one to leave a comment!} =1 {One comment} other {{commentCount, number, ::compact-short} Comments}}"
+ },
+ "messages.commentList.title.heading": {
+ "defaultMessage": "Comments"
+ },
"messages.commonMessages.javascriptErrorTitle": {
"defaultMessage": "Opps, something when wrong!"
},
+ "messages.content.status.errorLoadingComponent": {
+ "defaultMessage": "Something went wrong when loading this component."
+ },
"messages.popup.close": {
"defaultMessage": "Close"
},
@@ -209,11 +227,50 @@
"posts.comment.composer.content.label": {
"defaultMessage": "You are a surprise that I will only meet once in my life"
},
+ "posts.comment.composer.privacy.anynomous.negative": {
+ "defaultMessage": "Autonym"
+ },
+ "posts.comment.composer.privacy.anynomous.positive": {
+ "defaultMessage": "Anynomous"
+ },
+ "posts.comment.composer.privacy.anynomous.title": {
+ "defaultMessage": "Whether to comment as an anynomous user?"
+ },
+ "posts.comment.composer.privacy.subscribe.negative": {
+ "defaultMessage": "Unsubscribe"
+ },
+ "posts.comment.composer.privacy.subscribe.positive": {
+ "defaultMessage": "Subscribe"
+ },
+ "posts.comment.composer.privacy.subscribe.title": {
+ "defaultMessage": "Whether to inform you with email when receiving reply?"
+ },
+ "posts.comment.composer.privacy.visibility.negative": {
+ "defaultMessage": "Public"
+ },
+ "posts.comment.composer.privacy.visibility.positive": {
+ "defaultMessage": "Secret"
+ },
+ "posts.comment.composer.privacy.visibility.title": {
+ "defaultMessage": "Whether to create secret comment that only admins and peoples mentioned can see?"
+ },
"posts.comment.composer.submit.button": {
"defaultMessage": "Submit"
},
- "posts.comment.composer.tips.markdownSupported": {
- "defaultMessage": "Markdown Supported"
+ "posts.comment.composer.toolkits.emoji.tooltip": {
+ "defaultMessage": "Insert emoji"
+ },
+ "posts.comment.composer.toolkits.image.tooltip": {
+ "defaultMessage": "Attach image"
+ },
+ "posts.comment.composer.toolkits.markdown.tooltip": {
+ "defaultMessage": "'
Markdown' supported"
+ },
+ "posts.comment.composer.toolkits.preview.tooltip": {
+ "defaultMessage": "'
' Markdown preview"
+ },
+ "posts.comment.composer.toolkits.privacy.tooltip": {
+ "defaultMessage": "Privacy settings"
},
"posts.commentCount": {
"defaultMessage": "{commentCount, plural, =0 {No comment} =1 {One comment} other {{commentCount, number, ::compact-short} Comments}}"