From 368cb44499ff6a191e9e3b46d2b8ecc143da8473 Mon Sep 17 00:00:00 2001 From: tabinurie Date: Sun, 22 Nov 2020 13:54:54 +0900 Subject: [PATCH] Implement affeliate link shortcode --- assets/sass/components/_affeliate.scss | 124 ++++++++++++++++++ assets/sass/main.scss | 1 + exampleSite/content/en/posts/shortcodes.md | 11 ++ .../static/images/shortcodes/affeliate.jpg | Bin 0 -> 7418 bytes layouts/partials/svgs/affeliate/amazon.svg | 1 + layouts/partials/svgs/affeliate/gmarket.svg | 1 + layouts/partials/svgs/affeliate/link.svg | 1 + layouts/partials/svgs/affeliate/rakuten.svg | 1 + layouts/partials/svgs/affeliate/yahoojp.svg | 1 + layouts/shortcodes/affeliate.html | 42 ++++++ 10 files changed, 183 insertions(+) create mode 100644 assets/sass/components/_affeliate.scss create mode 100644 exampleSite/static/images/shortcodes/affeliate.jpg create mode 100644 layouts/partials/svgs/affeliate/amazon.svg create mode 100644 layouts/partials/svgs/affeliate/gmarket.svg create mode 100644 layouts/partials/svgs/affeliate/link.svg create mode 100644 layouts/partials/svgs/affeliate/rakuten.svg create mode 100644 layouts/partials/svgs/affeliate/yahoojp.svg create mode 100644 layouts/shortcodes/affeliate.html diff --git a/assets/sass/components/_affeliate.scss b/assets/sass/components/_affeliate.scss new file mode 100644 index 0000000..a7c6eea --- /dev/null +++ b/assets/sass/components/_affeliate.scss @@ -0,0 +1,124 @@ +.affeliate { + word-break: keep-all; + padding: 0.5rem; + margin: 2.5rem 0; + border-radius: 0.5rem; + position: relative; + display: flex; + + @include themify($themes) { + border: 1px solid themed('content-box-border-color'); + background-color: themed('content-box-background-color'); + } + + &__imgwrapper { + width: 25%; + text-align: center; + margin: 0 auto; + padding: .5rem; + } + &__image { + width: 100%; + height: auto; + object-fit: cover; + } + &__body { + width: 75%; + text-align: center; + &__title { + font-family: $title-font; + font-size: 1rem; + font-weight: bold; + } + &__description { + font-size: 0.75rem; + } + } + + &__icons { + @include flexbox(); + @include align-items(center); + @include justify-content(center); + @include flex-wrap(wrap); + margin: 0.5rem 0; + + a { + text-decoration: none !important; + } + } + + &__item { + font-family: $title-font; + font-size: 0.8rem; + cursor: pointer; + border-radius: 0.25rem; + margin: 0.25rem; + text-transform: capitalize; + + @include flexbox(); + @include align-items(center); + + &[data-type="affeliate"] { + svg { + @include themify($themes) { + color: themed('share-color'); + background-color: themed('share-background-color'); + @include box-shadow(1px, 1px, 3px, 0, themed('share-shadow-color')); + } + } + } + + svg { + padding: 0.375rem; + border-radius: 0.25rem; + margin-right: 0.25rem; + + &[data-name="amazon"] { + color: white; + @include on-event { + background-color: #FF9900; + } + } + &[data-name="rakuten"] { + color: white; + @include on-event { + background-color: #BF0000; + } + } + &[data-name="yahoojp"] { + color: white; + @include on-event { + background-color: #FF0132; + } + } + &[data-name="gmarket"] { + color: white; + @include on-event { + background-color: #48AC4A; + } + } + &[data-name="link"] { + color: white; + @include on-event { + background-color: #00457C; + } + } + + @include transition(transform, 0.15s, ease-in); + @include on-event { + @include translateY(-0.25rem); + } + } + } + + @media screen and (max-width: 767px) { + display: block; + + &__imgwrapper { + width: 60%; + } + &__body { + width: 100%; + } + } +} diff --git a/assets/sass/main.scss b/assets/sass/main.scss index 465f547..32033d0 100644 --- a/assets/sass/main.scss +++ b/assets/sass/main.scss @@ -82,6 +82,7 @@ $viewport_size: {{ .Site.Params.viewportSize | default "normal" }}; @import 'components/button'; @import 'components/featuredImage'; @import 'components/comment'; +@import 'components/affeliate'; @import 'pages/404'; @import 'pages/about'; diff --git a/exampleSite/content/en/posts/shortcodes.md b/exampleSite/content/en/posts/shortcodes.md index 880f40f..026433c 100644 --- a/exampleSite/content/en/posts/shortcodes.md +++ b/exampleSite/content/en/posts/shortcodes.md @@ -133,3 +133,14 @@ warning text {{< notice error >}} error text {{< /notice >}} + +## Affeliate +{{< affeliate title="The Very Hungry Caterpillar" + description="Author: Eric Carle; Publisher: Philomel Books
THE all-time classic picture book, from generation to generation, sold somewhere in the world every 30 seconds! A sturdy and beautiful book to give as a gift for new babies, baby showers, birthdays, and other new beginnings!" + img="images/shortcodes/affeliate.jpg" + amazon="https://www.amazon.com/dp/0399226907/" + rakuten="https://books.rakuten.co.jp/rb/4177444/" + yahoojp="https://store.shopping.yahoo.co.jp/maniacs-shop/pd-01041801.html" + gmarket="http://global.gmarket.co.kr/item?goodsCode=260740452" + link="https://www.penguinrandomhouse.com/books/557025/9780399256042" >}} + diff --git a/exampleSite/static/images/shortcodes/affeliate.jpg b/exampleSite/static/images/shortcodes/affeliate.jpg new file mode 100644 index 0000000000000000000000000000000000000000..e301ef6a930fe89eabe064f35ce01ebd15ccc2ff GIT binary patch literal 7418 zcmZ8_WmuI>+w~4QH??V`yBnnukPzu^1nF+1JEXh2L%LhKTM(pMkdlsfd*9FV9pC%T z^<$2!j+r^vnsu&oUcSF<03fnbGEx8_5C8zeF2KtVKo9^K83hRi2^AF?6$KR)6$65X zf{KoVj|aiUgkoc3K(R4#F)?wmaS3psxP;_HWP}7v6eQF*B&3{_T#S4)lFboD#0zg5%I$ty;_D=HB9+3;Uipt3!#39Mr`(Pt(w#`+cIEGKu!pSM)%j@x zRfq-05N)okM1;(46V4+R_TCu0EpRxQ%n+HJyFwD&=C;We>F`x5yy>i&;w`pxw64yg z$FLJg|LjFPt{%POp}m<*+$;{*yE`Gdf0}f-X7>NqZr1)0;Gxpw_y0v1AOZu22p0bT zjSUPdICvn!KhS_6|9%e^6wHq0RB2a_XuW}BT-G1s*q(-D&Hq4izh9JMWu3_WKy&`_ zpnku2;_^$Pv#^1I99m6@MweGY%_TA45O;&;MYoH68y{1mzaDG`|BwPU?*AbLJOXTF zAmYEI0RMO7rLGMGo}(M#tQ?7BOmn4E@A&%q-ZAl^CQ46Pm2O*pev7mz*~`9zdcET| z-o@PWrs2W)#_fAD$}%kdB`V7s%p9BF51o$9=r54e(TK5ji6zXd$p>nQ(vd~1#^?vo zg{7~(PoNQqU`Mr;?ks5BL*kU&k!)>q{O!NhJu;U$Z4fU?;?iJDQ=}9xHN8m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X zV1xgH{p5hGfGbCHt&|s{xW_2spzw8+q!*Dzy)hR`*#GAeW{9Q(tm8$M6H?8h8vdUt+^i7Y&^p43QJZ@Rj zX4)I*b*fzqjg8b{Yk|WJqW~OjJJ}xbH?v7NPjZ*$ahQrPwYJT2{s$dV4ZEDlM~U2?-SEK*(MnHDXNEdfQB4CJN$Bb-4l8io#c zcE^4DZvFNFd@)WPj??s~3I^W+Ex{>Np?j7B9rjc*b^)4&p(W!-He9d( literal 0 HcmV?d00001 diff --git a/layouts/partials/svgs/affeliate/amazon.svg b/layouts/partials/svgs/affeliate/amazon.svg new file mode 100644 index 0000000..b894ba4 --- /dev/null +++ b/layouts/partials/svgs/affeliate/amazon.svg @@ -0,0 +1 @@ + diff --git a/layouts/partials/svgs/affeliate/gmarket.svg b/layouts/partials/svgs/affeliate/gmarket.svg new file mode 100644 index 0000000..c32151d --- /dev/null +++ b/layouts/partials/svgs/affeliate/gmarket.svg @@ -0,0 +1 @@ + diff --git a/layouts/partials/svgs/affeliate/link.svg b/layouts/partials/svgs/affeliate/link.svg new file mode 100644 index 0000000..406f70a --- /dev/null +++ b/layouts/partials/svgs/affeliate/link.svg @@ -0,0 +1 @@ + diff --git a/layouts/partials/svgs/affeliate/rakuten.svg b/layouts/partials/svgs/affeliate/rakuten.svg new file mode 100644 index 0000000..624b51b --- /dev/null +++ b/layouts/partials/svgs/affeliate/rakuten.svg @@ -0,0 +1 @@ + diff --git a/layouts/partials/svgs/affeliate/yahoojp.svg b/layouts/partials/svgs/affeliate/yahoojp.svg new file mode 100644 index 0000000..848c63c --- /dev/null +++ b/layouts/partials/svgs/affeliate/yahoojp.svg @@ -0,0 +1 @@ + diff --git a/layouts/shortcodes/affeliate.html b/layouts/shortcodes/affeliate.html new file mode 100644 index 0000000..82abebb --- /dev/null +++ b/layouts/shortcodes/affeliate.html @@ -0,0 +1,42 @@ +
+
+ {{ if .Get "img" }} + {{ if .Get + {{ end }} +
+
+
+ {{ if .Get "title"}}{{ .Get "title" }}{{ end }} +
+
+ {{ if .Get "description"}}{{ .Get "description" | safeHTML }}{{ end }} +
+ +
+