From 8e171c1741528d4b91576a4e62b5a4d346b61edf Mon Sep 17 00:00:00 2001 From: icaraps Date: Thu, 5 Oct 2023 11:38:28 +0400 Subject: [PATCH] WIP icons overhaul --- bin/leaderboard/leaders.json | 2 +- blocks/carousel/carousel.css | 2 +- blocks/columns/columns.js | 7 +- blocks/courses/courses.js | 10 +- blocks/footer/footer.js | 39 +--- blocks/gallery/gallery.js | 12 +- blocks/header/header.css | 40 +++- blocks/header/header.js | 224 ++++------------------ blocks/hero/hero.js | 8 +- blocks/loop/loop.js | 7 +- blocks/social-share/social-share.js | 21 +- blocks/tiger-cards/tiger-cards.css | 4 +- blocks/tiger-cards/tiger-cards.js | 8 +- blocks/trending-banner/trending-banner.js | 8 +- icons/arrow-icon.svg | 1 - icons/arrow-right.svg | 1 + icons/close.svg | 7 + icons/england.svg | 9 + icons/facebook-red.svg | 4 + icons/facebook.svg | 1 + icons/gd-logo.svg | 7 + icons/gd-plus-logo.svg | 67 ++----- icons/instagram-red.svg | 6 + icons/linkedin.svg | 1 + icons/menu.svg | 5 + icons/next.svg | 3 + icons/northern-ireland.svg | 14 ++ icons/play.svg | 1 + icons/prev.svg | 3 + icons/search.svg | 4 +- icons/south-korea.svg | 9 + icons/spain.svg | 9 + icons/trending.svg | 1 + icons/twitter-red.svg | 4 + icons/twitter.svg | 1 + icons/united-states-of-america.svg | 9 + icons/youtube-red.svg | 5 + package.json | 2 +- scripts/lib-franklin.js | 8 +- scripts/scripts.js | 2 +- styles/styles.css | 13 +- 41 files changed, 242 insertions(+), 347 deletions(-) delete mode 100644 icons/arrow-icon.svg create mode 100644 icons/arrow-right.svg create mode 100644 icons/close.svg create mode 100644 icons/england.svg create mode 100644 icons/facebook-red.svg create mode 100644 icons/facebook.svg create mode 100644 icons/gd-logo.svg create mode 100644 icons/instagram-red.svg create mode 100644 icons/linkedin.svg create mode 100644 icons/menu.svg create mode 100644 icons/next.svg create mode 100644 icons/northern-ireland.svg create mode 100644 icons/play.svg create mode 100644 icons/prev.svg create mode 100644 icons/south-korea.svg create mode 100644 icons/spain.svg create mode 100644 icons/trending.svg create mode 100644 icons/twitter-red.svg create mode 100644 icons/twitter.svg create mode 100644 icons/united-states-of-america.svg create mode 100644 icons/youtube-red.svg diff --git a/bin/leaderboard/leaders.json b/bin/leaderboard/leaders.json index 447eef28..315641cf 100644 --- a/bin/leaderboard/leaders.json +++ b/bin/leaderboard/leaders.json @@ -1 +1 @@ -{"data":[{"Position":"1","RoundsPlayed":"4","FirstName":"Rory","LastName":"McIlroy","TotalScoreToPar":"-17","PlayerCountryCode":"NIR","CountryFlag":"//golfdigest.sports.sndimg.com/discovery.divot/images/countryflags/northern-ireland.svg","Rounds":[{"RoundNumber":"1","RoundsScoreToPar":"-5","HolesPlayed":"F"},{"RoundNumber":"2","RoundsScoreToPar":"-4","HolesPlayed":"F"},{"RoundNumber":"3","RoundsScoreToPar":"-4","HolesPlayed":"F"},{"RoundNumber":"4","RoundsScoreToPar":"-4","HolesPlayed":"F"}]},{"Position":"2","RoundsPlayed":"4","FirstName":"Kurt","LastName":"Kitayama","TotalScoreToPar":"-16","PlayerCountryCode":"USA","CountryFlag":"//golfdigest.sports.sndimg.com/discovery.divot/images/countryflags/united-states-of-america.svg","Rounds":[{"RoundNumber":"1","RoundsScoreToPar":"-5","HolesPlayed":"F"},{"RoundNumber":"2","RoundsScoreToPar":"-6","HolesPlayed":"F"},{"RoundNumber":"3","RoundsScoreToPar":"-1","HolesPlayed":"F"},{"RoundNumber":"4","RoundsScoreToPar":"-4","HolesPlayed":"F"}]},{"Position":"3","RoundsPlayed":"4","FirstName":"Kyoung-Hoon","LastName":"Lee","TotalScoreToPar":"-15","PlayerCountryCode":"KOR","CountryFlag":"//golfdigest.sports.sndimg.com/discovery.divot/images/countryflags/south-korea.svg","Rounds":[{"RoundNumber":"1","RoundsScoreToPar":"-3","HolesPlayed":"F"},{"RoundNumber":"2","RoundsScoreToPar":"-4","HolesPlayed":"F"},{"RoundNumber":"3","RoundsScoreToPar":"-5","HolesPlayed":"F"},{"RoundNumber":"4","RoundsScoreToPar":"-3","HolesPlayed":"F"}]},{"Position":"T4","RoundsPlayed":"4","FirstName":"Tommy","LastName":"Fleetwood","TotalScoreToPar":"-14","PlayerCountryCode":"ENG","CountryFlag":"//golfdigest.sports.sndimg.com/discovery.divot/images/countryflags/england.svg","Rounds":[{"RoundNumber":"1","RoundsScoreToPar":"+2","HolesPlayed":"F"},{"RoundNumber":"2","RoundsScoreToPar":"-5","HolesPlayed":"F"},{"RoundNumber":"3","RoundsScoreToPar":"-5","HolesPlayed":"F"},{"RoundNumber":"4","RoundsScoreToPar":"-6","HolesPlayed":"F"}]},{"Position":"T4","RoundsPlayed":"4","FirstName":"Jon","LastName":"Rahm","TotalScoreToPar":"-14","PlayerCountryCode":"ESP","CountryFlag":"//golfdigest.sports.sndimg.com/discovery.divot/images/countryflags/spain.svg","Rounds":[{"RoundNumber":"1","RoundsScoreToPar":"-2","HolesPlayed":"F"},{"RoundNumber":"2","RoundsScoreToPar":"-9","HolesPlayed":"F"},{"RoundNumber":"3","RoundsScoreToPar":"-1","HolesPlayed":"F"},{"RoundNumber":"4","RoundsScoreToPar":"-2","HolesPlayed":"F"}]}]} \ No newline at end of file +{"data":[{"Position":"1","RoundsPlayed":"4","FirstName":"Rory","LastName":"McIlroy","TotalScoreToPar":"-17","PlayerCountryCode":"NIR","CountryFlag":"/icons/northern-ireland.svg","Rounds":[{"RoundNumber":"1","RoundsScoreToPar":"-5","HolesPlayed":"F"},{"RoundNumber":"2","RoundsScoreToPar":"-4","HolesPlayed":"F"},{"RoundNumber":"3","RoundsScoreToPar":"-4","HolesPlayed":"F"},{"RoundNumber":"4","RoundsScoreToPar":"-4","HolesPlayed":"F"}]},{"Position":"2","RoundsPlayed":"4","FirstName":"Kurt","LastName":"Kitayama","TotalScoreToPar":"-16","PlayerCountryCode":"USA","CountryFlag":"/icons/united-states-of-america.svg","Rounds":[{"RoundNumber":"1","RoundsScoreToPar":"-5","HolesPlayed":"F"},{"RoundNumber":"2","RoundsScoreToPar":"-6","HolesPlayed":"F"},{"RoundNumber":"3","RoundsScoreToPar":"-1","HolesPlayed":"F"},{"RoundNumber":"4","RoundsScoreToPar":"-4","HolesPlayed":"F"}]},{"Position":"3","RoundsPlayed":"4","FirstName":"Kyoung-Hoon","LastName":"Lee","TotalScoreToPar":"-15","PlayerCountryCode":"KOR","CountryFlag":"/icons/south-korea.svg","Rounds":[{"RoundNumber":"1","RoundsScoreToPar":"-3","HolesPlayed":"F"},{"RoundNumber":"2","RoundsScoreToPar":"-4","HolesPlayed":"F"},{"RoundNumber":"3","RoundsScoreToPar":"-5","HolesPlayed":"F"},{"RoundNumber":"4","RoundsScoreToPar":"-3","HolesPlayed":"F"}]},{"Position":"T4","RoundsPlayed":"4","FirstName":"Tommy","LastName":"Fleetwood","TotalScoreToPar":"-14","PlayerCountryCode":"ENG","CountryFlag":"/icons/england.svg","Rounds":[{"RoundNumber":"1","RoundsScoreToPar":"+2","HolesPlayed":"F"},{"RoundNumber":"2","RoundsScoreToPar":"-5","HolesPlayed":"F"},{"RoundNumber":"3","RoundsScoreToPar":"-5","HolesPlayed":"F"},{"RoundNumber":"4","RoundsScoreToPar":"-6","HolesPlayed":"F"}]},{"Position":"T4","RoundsPlayed":"4","FirstName":"Jon","LastName":"Rahm","TotalScoreToPar":"-14","PlayerCountryCode":"ESP","CountryFlag":"/icons/spain.svg","Rounds":[{"RoundNumber":"1","RoundsScoreToPar":"-2","HolesPlayed":"F"},{"RoundNumber":"2","RoundsScoreToPar":"-9","HolesPlayed":"F"},{"RoundNumber":"3","RoundsScoreToPar":"-1","HolesPlayed":"F"},{"RoundNumber":"4","RoundsScoreToPar":"-2","HolesPlayed":"F"}]}]} diff --git a/blocks/carousel/carousel.css b/blocks/carousel/carousel.css index 5d8dfe1d..eb700ecb 100644 --- a/blocks/carousel/carousel.css +++ b/blocks/carousel/carousel.css @@ -801,7 +801,7 @@ height: 55px; border: none; border-radius: 0; - background: rgba(0 0 0 / 60%) url("/icons/arrow-icon.svg"); + background: rgba(0 0 0 / 60%) url("/icons/arrow-right.svg"); background-position: center center; background-size: 20px 30px; background-repeat: no-repeat; diff --git a/blocks/columns/columns.js b/blocks/columns/columns.js index eca8513d..344c1b43 100644 --- a/blocks/columns/columns.js +++ b/blocks/columns/columns.js @@ -5,7 +5,7 @@ import { } from '../../scripts/scripts.js'; import { - decorateBlock, loadBlock, + decorateBlock, decorateIcons, loadBlock, } from '../../scripts/lib-franklin.js'; export default async function decorate(block) { @@ -45,8 +45,7 @@ export default async function decorate(block) { const link = block.querySelector('.content-container a'); if (link) { - fetch('/icons/arrow-icon.svg').then((req) => req.text()).then((svg) => { - link.insertAdjacentHTML('afterbegin', `
${svg}
`); - }); + link.insertAdjacentHTML('afterbegin', '
'); + decorateIcons(link); } } diff --git a/blocks/courses/courses.js b/blocks/courses/courses.js index 0442c408..889e6d31 100644 --- a/blocks/courses/courses.js +++ b/blocks/courses/courses.js @@ -30,18 +30,10 @@ ratingElements.forEach((ratingElement, index) => { } }); -const arrowIcon = ` -
- - - -
-`; - const buttonElements = document.querySelectorAll('.courses-button'); buttonElements.forEach((button) => { - button.innerHTML += arrowIcon; + button.innerHTML += ''; }); // wrap courses info diff --git a/blocks/footer/footer.js b/blocks/footer/footer.js index 04e2abc6..9a7f7bf6 100644 --- a/blocks/footer/footer.js +++ b/blocks/footer/footer.js @@ -1,16 +1,12 @@ +import { decorateIcons } from '../../scripts/lib-franklin.js'; + const FOOTER_CONTENT_PATH = '/footer'; let templateDom = null; function getTemplate() { const footerTemplate = `