From a541461db46cf567b687d7941ff3d9505365e14e Mon Sep 17 00:00:00 2001 From: zzossig Date: Sun, 2 Feb 2020 02:58:22 +0900 Subject: [PATCH] button shortcode added --- README.ko.md | 1 + README.md | 1 + archetypes/author.md | 1 + assets/sass/components/_button.scss | 39 +++++++++++++++++++++++++ assets/sass/main.scss | 7 +++++ assets/sass/themes/_dark.scss | 1 + assets/sass/themes/_hacker.scss | 1 + assets/sass/themes/_kimbie.scss | 3 +- assets/sass/themes/_light.scss | 1 + assets/sass/themes/_solarized.scss | 1 + data/button.toml | 6 ++++ exampleSite/config/_default/params.toml | 1 + layouts/partials/svgs/social/gitea.svg | 1 + layouts/shortcodes/button.html | 5 ++++ 14 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 assets/sass/components/_button.scss create mode 100644 data/button.toml create mode 100644 layouts/partials/svgs/social/gitea.svg create mode 100644 layouts/shortcodes/button.html diff --git a/README.ko.md b/README.ko.md index 0147ed1..20e7fee 100644 --- a/README.ko.md +++ b/README.ko.md @@ -374,6 +374,7 @@ commento = false matrix = "" xmpp = "" dev-to = "" + gitea = "" [donationOptions] enable = false # if set, the donation button will show up on the single page. diff --git a/README.md b/README.md index 497fb97..863fdb0 100644 --- a/README.md +++ b/README.md @@ -365,6 +365,7 @@ commento = false matrix = "" xmpp = "" dev-to = "" + gitea = "" [donationOptions] enable = false # if set, the donation button will show up on the single page. diff --git a/archetypes/author.md b/archetypes/author.md index 115f30a..a554adc 100644 --- a/archetypes/author.md +++ b/archetypes/author.md @@ -42,4 +42,5 @@ socialOptions: matrix: "" xmpp: "" dev-to: "" + gitea: "" --- diff --git a/assets/sass/components/_button.scss b/assets/sass/components/_button.scss new file mode 100644 index 0000000..818d536 --- /dev/null +++ b/assets/sass/components/_button.scss @@ -0,0 +1,39 @@ +.button { + position: relative; + display: inline-block; + padding: 3px 9px; + margin: 0.5rem; + cursor: pointer; + text-decoration: none !important; + border-radius: 0.25rem; + + &__text { + margin: auto; + position: absolute; + top: 50%; + left: 50%; + @include translate(-50%, -50%); + } + + @include themify($themes) { + &[data-color="default"] { + color: themed('link'); + border: 1px solid themed('link'); + + @include on-event { + color: themed('link-hover'); + border: 1px solid themed('link-hover'); + } + } + + &[data-color="primary"] { + color: themed('button-primary-color'); + border: 1px solid themed('button-primary-color'); + + @include on-event { + color: themed('link-hover'); + border: 1px solid themed('link-hover'); + } + } + } +} \ No newline at end of file diff --git a/assets/sass/main.scss b/assets/sass/main.scss index 432bf71..7ef0230 100644 --- a/assets/sass/main.scss +++ b/assets/sass/main.scss @@ -21,6 +21,12 @@ $theme_hacker_chroma_background: {{ .Site.Data.skin.theme_hacker_chroma_backgrou $theme_solarized_chroma_background: {{ .Site.Data.skin.theme_solarized_chroma_background }}; $theme_kimbie_chroma_background: {{ .Site.Data.skin.theme_kimbie_chroma_background }}; +$button_dark_primary_color: {{ .Site.Data.button.dark_primary_color }}; +$button_light_primary_color: {{ .Site.Data.button.light_primary_color }}; +$button_hacker_primary_color: {{ .Site.Data.button.hacker_primary_color }}; +$button_solarized_primary_color: {{ .Site.Data.button.solarized_primary_color }}; +$button_kimbie_primary_color: {{ .Site.Data.button.kimbie_primary_color }}; + $title-font: {{ .Site.Data.font.title_font }}; $content-font: {{ .Site.Data.font.content_font }}; $cursive-font: {{ .Site.Data.font.cursive_font }}; @@ -71,6 +77,7 @@ $cursive-font: {{ .Site.Data.font.cursive_font }}; @import 'components/codetab'; @import 'components/ie'; @import 'components/tab'; +@import 'components/button'; @import 'pages/404'; @import 'pages/about'; diff --git a/assets/sass/themes/_dark.scss b/assets/sass/themes/_dark.scss index dac0fb8..9e5a945 100644 --- a/assets/sass/themes/_dark.scss +++ b/assets/sass/themes/_dark.scss @@ -106,4 +106,5 @@ $dark: ( share-shadow-color: #888, share-background-color: lighten(#403E41, 2.5%), donation-background-color: #525252, + button-primary-color: $button_dark_primary_color, ); \ No newline at end of file diff --git a/assets/sass/themes/_hacker.scss b/assets/sass/themes/_hacker.scss index 64e34c4..c30bbcb 100644 --- a/assets/sass/themes/_hacker.scss +++ b/assets/sass/themes/_hacker.scss @@ -106,4 +106,5 @@ $hacker: ( share-shadow-color: #888, share-background-color: #383b4c, donation-background-color: #43454d, + button-primary-color: $button_hacker_primary_color, ); \ No newline at end of file diff --git a/assets/sass/themes/_kimbie.scss b/assets/sass/themes/_kimbie.scss index c5ee49b..cbef8a0 100644 --- a/assets/sass/themes/_kimbie.scss +++ b/assets/sass/themes/_kimbie.scss @@ -2,7 +2,7 @@ $kimbie: ( footer-background-color: #423523, footer-color: #d3af86, link: #DC322F, - link-hover: #DC322F, + link-hover: #f06431, title-color: #996329, meta-color: #889b4a, body-color: #e3b583, @@ -105,4 +105,5 @@ $kimbie: ( share-shadow-color: #828282, share-background-color: #403c38, donation-background-color: #52493c, + button-primary-color: $button_kimbie_primary_color, ); \ No newline at end of file diff --git a/assets/sass/themes/_light.scss b/assets/sass/themes/_light.scss index e613da2..9fb87c6 100644 --- a/assets/sass/themes/_light.scss +++ b/assets/sass/themes/_light.scss @@ -105,4 +105,5 @@ $light: ( share-shadow-color: #727072, share-background-color: #90a4ae, donation-background-color: #eceff1, + button-primary-color: $button_light_primary_color, ); \ No newline at end of file diff --git a/assets/sass/themes/_solarized.scss b/assets/sass/themes/_solarized.scss index 0372071..57bf567 100644 --- a/assets/sass/themes/_solarized.scss +++ b/assets/sass/themes/_solarized.scss @@ -104,4 +104,5 @@ $solarized: ( share-shadow-color: #727072, share-background-color: #99907a, donation-background-color: #c5e0df, + button-primary-color: $button_solarized_primary_color, ); \ No newline at end of file diff --git a/data/button.toml b/data/button.toml new file mode 100644 index 0000000..67b354c --- /dev/null +++ b/data/button.toml @@ -0,0 +1,6 @@ +# restart hugo after set the values +dark_primary_color = "#82aaff" +light_primary_color = "#728fcb" +hacker_primary_color = "#cddc39" +solarized_primary_color = "#689f38" +kimbie_primary_color = "#8ab1b0" \ No newline at end of file diff --git a/exampleSite/config/_default/params.toml b/exampleSite/config/_default/params.toml index 107fc84..04b5705 100644 --- a/exampleSite/config/_default/params.toml +++ b/exampleSite/config/_default/params.toml @@ -143,6 +143,7 @@ commento = false matrix = "" xmpp = "" dev-to = "" + gitea = "" [donationOptions] enable = false diff --git a/layouts/partials/svgs/social/gitea.svg b/layouts/partials/svgs/social/gitea.svg new file mode 100644 index 0000000..408ecb7 --- /dev/null +++ b/layouts/partials/svgs/social/gitea.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/layouts/shortcodes/button.html b/layouts/shortcodes/button.html new file mode 100644 index 0000000..378fac4 --- /dev/null +++ b/layouts/shortcodes/button.html @@ -0,0 +1,5 @@ + + + {{ .Inner | markdownify }} + + \ No newline at end of file