diff --git a/app/components/footer/bootstrap.yaml b/app/components/footer/bootstrap.yaml index 808d3e8..133b385 100644 --- a/app/components/footer/bootstrap.yaml +++ b/app/components/footer/bootstrap.yaml @@ -1,3 +1,5 @@ _components: footer: - footerLinks: [] + svgLogo: '' + logoUrl: '' + navigationLinks: [] diff --git a/app/components/footer/client.js b/app/components/footer/client.js new file mode 100644 index 0000000..2d0be92 --- /dev/null +++ b/app/components/footer/client.js @@ -0,0 +1,57 @@ +'use strict'; + +const _find = require('lodash/find'), + $popup = require('../../services/client/popup'); + +module.exports = (el) => { + const socialMediaButtons = el.querySelectorAll('.social-media-btn'), + // new social media network should also be added to 'socialMediaLinks in schema.yaml' + supportedSocialNetworks = [ + { + className: 'facebook', + url: 'https://facebook.com/{handle}', + network: 'Facebook' + }, + { + className: 'instagram', + url: 'https://www.instagram.com/{handle}', + network: 'Instagram' + }, + { + className: 'twitter-black', + url: 'https://twitter.com/intent/follow?screen_name={handle}&tw_p=followbutton&variant=2.0', + network: 'Twitter' + } + ]; + + if (socialMediaButtons.length) { + socialMediaButtons.forEach((element) => { + element.addEventListener('click', (e) => { + e.preventDefault(); + let Position = $popup.position, + Params = $popup.params, + opts = {}, + dimensions = { width: 780, height: 500 }, + features = new Position(dimensions.width, dimensions.height), + classList = e.currentTarget.classList, + args, + socialHandler, + socialNetworks = supportedSocialNetworks; + + opts.handle = e.currentTarget.getAttribute('data-handle'); + + dimensions.left = features.left; + dimensions.top = features.top; + + socialHandler = _find(socialNetworks, ({ className }) => classList.contains(className)); + + opts.url = socialHandler.url.replace('{handle}', opts.handle); + opts.network = socialHandler.network; + + opts.name = `Follow ${opts.handle} on ${opts.network}`; + args = new Params(opts, dimensions); + window.open(args.address, args.name, args.features); + }); + }); + } +}; diff --git a/app/components/footer/schema.yaml b/app/components/footer/schema.yaml index 550151b..a70f9fc 100644 --- a/app/components/footer/schema.yaml +++ b/app/components/footer/schema.yaml @@ -1,8 +1,47 @@ _description: | - footer + The footer at the bottom of all pages. +_confirmRemoval: true -footerLinks: - _label: Footer Links +socialMediaNetworks: + _label: Social Media Links + _placeholder: + text: New Follow + height: 56px + _has: + input: complex-list + props: + - + prop: socialMediaNetwork + _label: socialMediaNetwork + _has: + input: radio + help: Select the network for this follow button + options: # new social media network should also be added to 'supportedSocialNetworks' in client.js + - name: 'Facebook' + value: 'facebook' + - name: 'Twitter' + value: 'twitter-black' + - name: 'Instagram' + value: 'instagram' + - + prop: handle + _label: Social Media Handle + _has: + input: text + validate: + required: true + - + prop: icon + _label: Social Media Icon + _has: + input: text + help: Support SVG + +navigationLinks: + _label: Navegation Links + _placeholder: + text: Navegation Links + height: 56px _has: input: complex-list props: @@ -11,7 +50,7 @@ footerLinks: _label: Url _has: input: text - type: url + help: Example https://domain.com validate: required: true - @@ -25,7 +64,29 @@ footerLinks: max: 40 maxMessage: This field must be 40 or fewer characters long +svgLogo: + _label: Site Logo + _placeholder: + height: 56px + _has: + input: text + help: Support SVG + +logoUrl: + _label: Logo URL + _placeholder: + height: 56px + _has: + input: text + help: Example https://domain.com + _groups: settings: fields: - - footerLinks + - svgLogo (General) + - logoUrl (General) + - navigationLinks (Navegation Links) + _placeholder: + text: Footer + height: 30px + ifEmpty: logoUrl AND svgLogo diff --git a/app/components/footer/template.hbs b/app/components/footer/template.hbs index 7d2c486..b18107c 100644 --- a/app/components/footer/template.hbs +++ b/app/components/footer/template.hbs @@ -1,10 +1,36 @@ -