From c3c24f83e373be0551b26102ba325b693057d834 Mon Sep 17 00:00:00 2001 From: Sciroccogti Date: Sat, 21 Jan 2023 18:20:37 +0800 Subject: [PATCH] merge sub-menu --- assets/icons/arrow-down.svg | 6 + assets/scss/partials/menu.scss | 48 ++++++- exampleSite/config/_default/config.toml | 16 +++ exampleSite/config/_default/languages.toml | 7 + exampleSite/config/_default/markup.toml | 17 +++ exampleSite/config/_default/menu.toml | 39 ++++++ exampleSite/config/_default/module.toml | 2 + exampleSite/config/_default/params.toml | 148 ++++++++++++++++++++ exampleSite/config/_default/permalinks.toml | 3 + exampleSite/config/_default/related.toml | 12 ++ layouts/partials/sidebar/left.html | 48 +++++-- 11 files changed, 332 insertions(+), 14 deletions(-) create mode 100644 assets/icons/arrow-down.svg create mode 100644 exampleSite/config/_default/config.toml create mode 100644 exampleSite/config/_default/languages.toml create mode 100644 exampleSite/config/_default/markup.toml create mode 100644 exampleSite/config/_default/menu.toml create mode 100644 exampleSite/config/_default/module.toml create mode 100644 exampleSite/config/_default/params.toml create mode 100644 exampleSite/config/_default/permalinks.toml create mode 100644 exampleSite/config/_default/related.toml diff --git a/assets/icons/arrow-down.svg b/assets/icons/arrow-down.svg new file mode 100644 index 0000000..c8f70d9 --- /dev/null +++ b/assets/icons/arrow-down.svg @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/assets/scss/partials/menu.scss b/assets/scss/partials/menu.scss index 5b6be17..981bd92 100644 --- a/assets/scss/partials/menu.scss +++ b/assets/scss/partials/menu.scss @@ -21,12 +21,15 @@ margin: 0; overflow: visible; } + .hamburger:hover { opacity: 0.7; } + .hamburger.is-active:hover { opacity: 0.7; } + .hamburger.is-active .hamburger-inner, .hamburger.is-active .hamburger-inner::before, .hamburger.is-active .hamburger-inner::after { @@ -58,14 +61,17 @@ transition-duration: 0.15s; transition-timing-function: ease; } + .hamburger-inner::before, .hamburger-inner::after { content: ""; display: block; } + .hamburger-inner::before { top: -10px; } + .hamburger-inner::after { bottom: -10px; } @@ -74,9 +80,11 @@ transition-duration: 0.22s; transition-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); } + .hamburger--spin .hamburger-inner::before { transition: top 0.1s 0.25s ease-in, opacity 0.1s ease-in; } + .hamburger--spin .hamburger-inner::after { transition: bottom 0.1s 0.25s ease-in, transform 0.22s cubic-bezier(0.55, 0.055, 0.675, 0.19); } @@ -86,11 +94,13 @@ transition-delay: 0.12s; transition-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); } + .hamburger--spin.is-active .hamburger-inner::before { top: 0; opacity: 0; transition: top 0.1s ease-out, opacity 0.1s 0.12s ease-out; } + .hamburger--spin.is-active .hamburger-inner::after { bottom: 0; transform: rotate(-90deg); @@ -118,6 +128,7 @@ outline: none; &.is-active { + .hamburger-inner, .hamburger-inner::before, .hamburger-inner::after { @@ -210,6 +221,41 @@ } } } + + .dropdown { + position: relative; + } + + .dropdown-header { + height: auto; + } + + .dropdown-header svg { + transition-duration: 0.15s; + } + + .dropdown-content { + display: none; + // position: absolute; + width: 100%; + transition-duration: 0.15s; + padding: 0; + } + + .dropdown:hover { + .dropdown-header svg { + transform: rotate(180deg); + } + + .dropdown-content { + display: block; + } + } + + .dropdown-item { + list-style: none; + padding: 0.2rem 0; + } } .menu-social { @@ -226,4 +272,4 @@ stroke: var(--body-text-color); stroke-width: 1.33; } -} +} \ No newline at end of file diff --git a/exampleSite/config/_default/config.toml b/exampleSite/config/_default/config.toml new file mode 100644 index 0000000..52ed831 --- /dev/null +++ b/exampleSite/config/_default/config.toml @@ -0,0 +1,16 @@ +# Change baseurl before deploy +baseurl = "https://demo.stack.jimmycai.com" +languageCode = "en-us" +paginate = 5 +title = "Hugo Theme Stack Starter" + +# Theme i18n support +# Available values: en, fr, id, ja, ko, pt-br, zh-cn, zh-tw, es, de, nl, it, th, el, uk, ar +DefaultContentLanguage = "en" + +# Set hasCJKLanguage to true if DefaultContentLanguage is in [zh-cn ja ko] +# This will make .Summary and .WordCount behave correctly for CJK languages. +hasCJKLanguage = false + +# Change it to your Disqus shortname before using +disqusShortname = "hugo-theme-stack" \ No newline at end of file diff --git a/exampleSite/config/_default/languages.toml b/exampleSite/config/_default/languages.toml new file mode 100644 index 0000000..6714e14 --- /dev/null +++ b/exampleSite/config/_default/languages.toml @@ -0,0 +1,7 @@ +# Uncomment this file to enable multilanguage site support + +#[en] +#languageName = "English" +#languagedirection = "ltr" +#title = "Example Site" +#weight = 1 diff --git a/exampleSite/config/_default/markup.toml b/exampleSite/config/_default/markup.toml new file mode 100644 index 0000000..1dc01f3 --- /dev/null +++ b/exampleSite/config/_default/markup.toml @@ -0,0 +1,17 @@ +# Markdown renderer configuration +[goldmark.renderer] +unsafe = false + +[tableOfContents] +endLevel = 4 +ordered = true +startLevel = 2 + +[highlight] +noClasses = false +codeFences = true +guessSyntax = true +lineNoStart = 1 +lineNos = true +lineNumbersInTable = true +tabWidth = 4 diff --git a/exampleSite/config/_default/menu.toml b/exampleSite/config/_default/menu.toml new file mode 100644 index 0000000..94ad8f1 --- /dev/null +++ b/exampleSite/config/_default/menu.toml @@ -0,0 +1,39 @@ +# Configure main menu and social menu +[[main]] +identifier = "home" +name = "Home" +url = "/" +[main.params] +icon = "home" +newtab = true + +[[main]] + identifier = "others" + name = "Others" + # parent menu uses icon arrow-down + +# submenu +[[main]] + parent = "others" + identifier = "rss" + name = "rss" + url = "index.xml" + [main.params] + icon = "rss" + newtab = true + +[[social]] +identifier = "github" +name = "GitHub" +url = "https://github.com/CaiJimmy/hugo-theme-stack" + +[social.params] +icon = "brand-github" + +[[social]] +identifier = "twitter" +name = "Twitter" +url = "https://twitter.com" + +[social.params] +icon = "brand-twitter" diff --git a/exampleSite/config/_default/module.toml b/exampleSite/config/_default/module.toml new file mode 100644 index 0000000..f13256c --- /dev/null +++ b/exampleSite/config/_default/module.toml @@ -0,0 +1,2 @@ +[[imports]] +path = "github.com/CaiJimmy/hugo-theme-stack/v3" diff --git a/exampleSite/config/_default/params.toml b/exampleSite/config/_default/params.toml new file mode 100644 index 0000000..be33413 --- /dev/null +++ b/exampleSite/config/_default/params.toml @@ -0,0 +1,148 @@ +# Pages placed under these sections will be shown on homepage and archive page. +mainSections = ["post"] +# Output page's full content in RSS. +rssFullContent = true + +[footer] +since = 2020 +customText = "" + +[dateFormat] +published = "Jan 02, 2006" +lastUpdated = "Jan 02, 2006 15:04 MST" + +[sidebar] +emoji = "🍥" +subtitle = "Lorem ipsum dolor sit amet, consectetur adipiscing elit." + +[sidebar.avatar] +enabled = true +local = true +src = "img/avatar.png" + +[article] +math = false +readingTime = true + +[article.license] +enabled = true +default = "Licensed under CC BY-NC-SA 4.0" + +## Widgets +[[widgets.homepage]] +type = "search" + +[[widgets.homepage]] +type = "archives" + +[widgets.homepage.params] +limit = 5 + +[[widgets.homepage]] +type = "categories" + +[widgets.homepage.params] +limit = 10 + +[[widgets.homepage]] +type = "tag-cloud" + +[widgets.homepage.params] +limit = 10 + +[[widgets.page]] +type = "toc" + +[opengraph.twitter] +site = "" +card = "summary_large_image" + +[defaultImage.opengraph] +enabled = false +local = false +src = "" + +[colorScheme] +toggle = true +default = "auto" + +[imageProcessing.cover] +enabled = true + +[imageProcessing.content] +enabled = true + +## Comments +[comments] +enabled = true +provider = "disqus" + +[comments.disqusjs] +shortname = "" +apiUrl = "" +apiKey = "" +admin = "" +adminLabel = "" + +[comments.utterances] +repo = "" +issueTerm = "pathname" +label = "" + +[comments.remark42] +host = "" +site = "" +locale = "" + +[comments.vssue] +platform = "" +owner = "" +repo = "" +clientId = "" +clientSecret = "" +autoCreateIssue = false + +[comments.waline] +serverURL = "" +lang = "" +visitor = "" +avatar = "" +emoji = ["https://cdn.jsdelivr.net/gh/walinejs/emojis/weibo"] +requiredMeta = ["name", "email", "url"] +placeholder = "" + +[comments.waline.locale] +admin = "Admin" + +[comments.twikoo] +envId = "" +region = "" +path = "" +lang = "" + +[comments.cactus] +defaultHomeserverUrl = "https://matrix.cactus.chat:8448" +serverName = "cactus.chat" +siteName = "" + +[comments.giscus] +repo = "" +repoID = "" +category = "" +categoryID = "" +mapping = "" +lightTheme = "" +darkTheme = "" +reactionsEnabled = 1 +emitMetadata = 0 + +[comments.gitalk] +owner = "" +admin = "" +repo = "" +clientID = "" +clientSecret = "" + +[comments.cusdis] +host = "" +id = "" diff --git a/exampleSite/config/_default/permalinks.toml b/exampleSite/config/_default/permalinks.toml new file mode 100644 index 0000000..2499a7e --- /dev/null +++ b/exampleSite/config/_default/permalinks.toml @@ -0,0 +1,3 @@ +# Permalinks format of each content section +post = "/p/:slug/" +page = "/:slug/" \ No newline at end of file diff --git a/exampleSite/config/_default/related.toml b/exampleSite/config/_default/related.toml new file mode 100644 index 0000000..ae9f69a --- /dev/null +++ b/exampleSite/config/_default/related.toml @@ -0,0 +1,12 @@ +# Related contents configuration +includeNewer = true +threshold = 60 +toLower = false + +[[indices]] +name = "tags" +weight = 100 + +[[indices]] +name = "categories" +weight = 200 diff --git a/layouts/partials/sidebar/left.html b/layouts/partials/sidebar/left.html index 21e7d3e..70cf3ba 100644 --- a/layouts/partials/sidebar/left.html +++ b/layouts/partials/sidebar/left.html @@ -60,19 +60,41 @@