From b193b42ad8977503917d2fc5cd3731fbd223b977 Mon Sep 17 00:00:00 2001 From: Dave Date: Mon, 10 Jan 2022 15:38:12 +0000 Subject: [PATCH 01/60] Journal article main content updates (#1101) * refactor main article width/gutters to grid * Add DNA string for testing * Potential fix for long urls * Move article columns to article-section scss file * Refactor article section for secondary column --- .../patterns/molecules/article-section.scss | 50 ++++++++++++++++++- .../patterns/molecules/view-selector.scss | 9 ++-- .../patterns/organisms/content-header.scss | 1 - 3 files changed, 53 insertions(+), 7 deletions(-) diff --git a/assets/sass/patterns/molecules/article-section.scss b/assets/sass/patterns/molecules/article-section.scss index b85734405..fbb5bd004 100644 --- a/assets/sass/patterns/molecules/article-section.scss +++ b/assets/sass/patterns/molecules/article-section.scss @@ -9,7 +9,8 @@ $arrow-size: 5; } p > a { - overflow-wrap: break-word; + word-wrap: break-word; + word-break: break-all; } } @@ -257,3 +258,50 @@ $arrow-size: 5; } } } + +.divider { + border-bottom: 1px solid $color-text-dividers; + grid-column: 2/12; + height: 1px; + width: 100%; + + @media only all and (min-width: #{get-rem-from-px($bkpt-site--x-wide)}em) { + grid-column: 1/13; + } +} + +.main-content-grid { + + @media only all and (min-width: #{get-rem-from-px($bkpt-site--medium)}em) { + grid-column: 2/12; + grid-row: 2; + } + + @media only all and (min-width: #{get-rem-from-px($bkpt-site--wide)}em) { + grid-column: 2/9; + } + + @media only all and (min-width: #{get-rem-from-px($bkpt-site--x-wide)}em) { + grid-column: 3/10; + grid-row: 1; + margin-left: 70px; + width: 100%; + } +} + +.secondary-column-grid { + display: grid; + + @media only all and (min-width: #{get-rem-from-px($bkpt-site--wide)}em) { + grid-column: 8/12; + grid-row: 2; + justify-self: end; + margin-left: 70px; + max-width: 200px; + } + + @media only all and (min-width: #{get-rem-from-px($bkpt-site--x-wide)}em) { + grid-column: 10/13; + grid-row: 1; + } +} diff --git a/assets/sass/patterns/molecules/view-selector.scss b/assets/sass/patterns/molecules/view-selector.scss index 31e37823d..c98f78c01 100644 --- a/assets/sass/patterns/molecules/view-selector.scss +++ b/assets/sass/patterns/molecules/view-selector.scss @@ -82,9 +82,8 @@ .view-selector--has-figures { display: inline-block; width: 100%; - @supports (display: flex) { - display: flex; - } + grid-column: 1/13; + grid-row: 1; } .view-selector__list { @@ -151,8 +150,8 @@ // Applied with js to stop the selector scrolling off the top of the screen. .view-selector { // Supply what was being provided by the grid now this element has been taken out the flow. - @include constrain-width(210, "max"); - width: 9.625rem; + grid-column: 1/3; + grid-row: 1; } .view-selector--fixed { diff --git a/assets/sass/patterns/organisms/content-header.scss b/assets/sass/patterns/organisms/content-header.scss index 46cfba4bf..bd84cc2e8 100644 --- a/assets/sass/patterns/organisms/content-header.scss +++ b/assets/sass/patterns/organisms/content-header.scss @@ -17,7 +17,6 @@ border-bottom: 1px solid $color-text-dividers; content: ""; display: block; - @include padding($content-header-padding - 1, "top"); width: 100%; } From 4a282e02266ec2e82585a7dfa5aa50de3dbc558b Mon Sep 17 00:00:00 2001 From: Dave Price Date: Fri, 14 Jan 2022 10:40:52 +0000 Subject: [PATCH 02/60] Initial work for creating share modal popup --- assets/js/components/Modal.js | 28 ++++++++++++++++++ assets/js/main.js | 1 + .../sass/patterns/molecules/modal-window.scss | 29 +++++++++++++++++++ .../components/modal-window.mustache | 8 +++++ 4 files changed, 66 insertions(+) create mode 100644 assets/js/components/Modal.js create mode 100644 assets/sass/patterns/molecules/modal-window.scss create mode 100644 source/_patterns/01-molecules/components/modal-window.mustache diff --git a/assets/js/components/Modal.js b/assets/js/components/Modal.js new file mode 100644 index 000000000..1e0f85cee --- /dev/null +++ b/assets/js/components/Modal.js @@ -0,0 +1,28 @@ +'use strict'; + +window.addEventListener('resize', function () { + if (window.innerWidth < 480) { + console.log('test'); + + const modalWindow = document.querySelector('.modal-container'); + const modalBtnClick = document.querySelector('.modal-click'); + const modalButtonClose = document.querySelector('.modal-content__button'); + + function modalToggle() { + modalWindow.classList.toggle('modal-content__show'); + } + + function windowOnClick(event) { + if (event.target === modalWindow) { + modalToggle(); + } + } + + if (document.querySelector('.modal-container')) { + modalBtnClick.addEventListener('click', modalToggle); + modalButtonClose.addEventListener('click', modalToggle); + window.addEventListener('click', windowOnClick); + } + + } +}); diff --git a/assets/js/main.js b/assets/js/main.js index dc94b395e..a2978c721 100644 --- a/assets/js/main.js +++ b/assets/js/main.js @@ -30,6 +30,7 @@ Components.MainMenu = require('./components/MainMenu'); Components.Math = require('./components/Math'); Components.MediaChapterListingItem = require('./components/MediaChapterListingItem'); Components.Metrics = require('./components/Metrics'); +Components.Modal = require('./components/Modal'); Components.Pager = require('./components/Pager'); Components.PersonalisedCoverDownload = require('./components/PersonalisedCoverDownload'); Components.Popup = require('./components/Popup'); diff --git a/assets/sass/patterns/molecules/modal-window.scss b/assets/sass/patterns/molecules/modal-window.scss new file mode 100644 index 000000000..81a4c4c78 --- /dev/null +++ b/assets/sass/patterns/molecules/modal-window.scss @@ -0,0 +1,29 @@ +.modal-container { + background-color: rgba(255,255,255,0.5); + height: 100%; + left: 0; + position: fixed; + top: 0; + width: 100%; + visibility: hidden; +} + +.modal-content { + background-color: #fff; + box-shadow: 0 0 20px rgba(0, 0, 0, 0.22); + border-radius: 3px; + display: grid; + margin: 24px; + padding: 36px 24px; +} + +.modal-content__show { + opacity: 1; + visibility: visible; +} + +.modal-content__button { + grid-row: 1; + justify-self: end; + text-decoration: none; +} diff --git a/source/_patterns/01-molecules/components/modal-window.mustache b/source/_patterns/01-molecules/components/modal-window.mustache new file mode 100644 index 000000000..121096fb3 --- /dev/null +++ b/source/_patterns/01-molecules/components/modal-window.mustache @@ -0,0 +1,8 @@ + + + \ No newline at end of file From 3e354738d983554392163444043a934cd0fbfad2 Mon Sep 17 00:00:00 2001 From: Dave Date: Mon, 24 Jan 2022 11:55:02 +0000 Subject: [PATCH 03/60] Add table variations and fix bug for lists inside tables (#1104) * Add table variations and fix bug for lists inside tables * Format code * Remove unwanted code * Reverting to original From ced7d4d34477f1639bb2a07ff2d767db7fd4c387 Mon Sep 17 00:00:00 2001 From: Dave Date: Tue, 25 Jan 2022 09:44:08 +0000 Subject: [PATCH 04/60] Table list indentation issue (#1105) * Add table variations and fix bug for lists inside tables * Format code * Remove unwanted code * Reverting to original * Update font, font-size for list items and paragraphs in tables From 0acea238121851da8d0f1cfd0a689d747fcd82d9 Mon Sep 17 00:00:00 2001 From: Dave Price Date: Tue, 25 Jan 2022 13:54:40 +0000 Subject: [PATCH 05/60] Changes to js and adding data behaviour --- assets/js/components/Modal.js | 58 +++++++++++++------ .../sass/patterns/molecules/modal-window.scss | 4 ++ .../components/modal-window.mustache | 16 ++--- 3 files changed, 52 insertions(+), 26 deletions(-) diff --git a/assets/js/components/Modal.js b/assets/js/components/Modal.js index 1e0f85cee..bc2bcf7af 100644 --- a/assets/js/components/Modal.js +++ b/assets/js/components/Modal.js @@ -1,28 +1,48 @@ 'use strict'; -window.addEventListener('resize', function () { - if (window.innerWidth < 480) { - console.log('test'); +module.exports = class Modal { - const modalWindow = document.querySelector('.modal-container'); - const modalBtnClick = document.querySelector('.modal-click'); - const modalButtonClose = document.querySelector('.modal-content__button'); - - function modalToggle() { - modalWindow.classList.toggle('modal-content__show'); + constructor($elm, _window = window, doc = document) { + if (!$elm) { + return; } - function windowOnClick(event) { - if (event.target === modalWindow) { - modalToggle(); - } - } + this.$elm = $elm; + this.window = _window; + this.doc = doc; + + this.modalWindow = this.$elm.querySelector('.modal-container'); + this.$elm.querySelector('.modal-click').addEventListener('click', (event) => this.modalToggle(event)); + this.$elm.querySelector('.modal-content__button').addEventListener('click', (event) => this.modalToggle(event)); + this.window.addEventListener('click', (event) => this.windowOnClick(event)); + + this.window.addEventListener('resize', () => { + this.modalSetup(); + }); + + this.modalSetup(); + } - if (document.querySelector('.modal-container')) { - modalBtnClick.addEventListener('click', modalToggle); - modalButtonClose.addEventListener('click', modalToggle); - window.addEventListener('click', windowOnClick); + modalToggle(event) { + this.modalWindow.classList.toggle('modal-content__show'); + event.preventDefault(); + } + + windowOnClick(event) { + if (event.target === this.modalWindow) { + this.modalToggle(event); } + } + modalSetup() { + if (this.window.innerWidth < 480) { + this.$elm.classList.remove('modal-nojs'); + console.log('below'); + } else { + this.modalWindow.classList.remove('modal-content__show'); + this.$elm.classList.add('modal-nojs'); + console.log('above'); + } } -}); + +}; diff --git a/assets/sass/patterns/molecules/modal-window.scss b/assets/sass/patterns/molecules/modal-window.scss index 81a4c4c78..cb0ac42da 100644 --- a/assets/sass/patterns/molecules/modal-window.scss +++ b/assets/sass/patterns/molecules/modal-window.scss @@ -27,3 +27,7 @@ justify-self: end; text-decoration: none; } + +.modal-nojs { + visibility: none; +} diff --git a/source/_patterns/01-molecules/components/modal-window.mustache b/source/_patterns/01-molecules/components/modal-window.mustache index 121096fb3..7a67102c7 100644 --- a/source/_patterns/01-molecules/components/modal-window.mustache +++ b/source/_patterns/01-molecules/components/modal-window.mustache @@ -1,8 +1,10 @@ - + From 6ab193ff4d4ade7075e5ed27ece88830fac64708 Mon Sep 17 00:00:00 2001 From: Dave Price Date: Tue, 25 Jan 2022 13:59:11 +0000 Subject: [PATCH 06/60] Fix css for modal --- assets/sass/patterns/molecules/modal-window.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/sass/patterns/molecules/modal-window.scss b/assets/sass/patterns/molecules/modal-window.scss index cb0ac42da..99b477861 100644 --- a/assets/sass/patterns/molecules/modal-window.scss +++ b/assets/sass/patterns/molecules/modal-window.scss @@ -29,5 +29,5 @@ } .modal-nojs { - visibility: none; + visibility: hidden; } From a9eb22bb9cb8c35ffd5dcc782eece3ff987f6f4b Mon Sep 17 00:00:00 2001 From: Dave Price Date: Tue, 25 Jan 2022 14:14:14 +0000 Subject: [PATCH 07/60] removing console logs on modal --- assets/js/components/Modal.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/assets/js/components/Modal.js b/assets/js/components/Modal.js index bc2bcf7af..e92f93f32 100644 --- a/assets/js/components/Modal.js +++ b/assets/js/components/Modal.js @@ -37,11 +37,9 @@ module.exports = class Modal { modalSetup() { if (this.window.innerWidth < 480) { this.$elm.classList.remove('modal-nojs'); - console.log('below'); } else { this.modalWindow.classList.remove('modal-content__show'); this.$elm.classList.add('modal-nojs'); - console.log('above'); } } From 8839aa0c321d147b4e176e63d24cd446aba881ca Mon Sep 17 00:00:00 2001 From: Dave Date: Tue, 25 Jan 2022 14:26:36 +0000 Subject: [PATCH 08/60] Merge branch 'develop' into share-popup-modal From b60b0fd57edb293c590ef54dd3cb3de8c1fe3666 Mon Sep 17 00:00:00 2001 From: nlisgo Date: Tue, 25 Jan 2022 15:04:03 +0000 Subject: [PATCH 09/60] Move modal-window to atoms --- assets/sass/patterns/{molecules => atoms}/modal-window.scss | 0 .../{01-molecules => 00-atoms}/components/modal-window.mustache | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename assets/sass/patterns/{molecules => atoms}/modal-window.scss (100%) rename source/_patterns/{01-molecules => 00-atoms}/components/modal-window.mustache (100%) diff --git a/assets/sass/patterns/molecules/modal-window.scss b/assets/sass/patterns/atoms/modal-window.scss similarity index 100% rename from assets/sass/patterns/molecules/modal-window.scss rename to assets/sass/patterns/atoms/modal-window.scss diff --git a/source/_patterns/01-molecules/components/modal-window.mustache b/source/_patterns/00-atoms/components/modal-window.mustache similarity index 100% rename from source/_patterns/01-molecules/components/modal-window.mustache rename to source/_patterns/00-atoms/components/modal-window.mustache From 1e4a6646d81aa9e219a565f6fced9e265b21b63d Mon Sep 17 00:00:00 2001 From: Dave Price Date: Tue, 25 Jan 2022 15:32:31 +0000 Subject: [PATCH 10/60] Adding modal json file for parameters --- source/_patterns/00-atoms/components/modal-window.json | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 source/_patterns/00-atoms/components/modal-window.json diff --git a/source/_patterns/00-atoms/components/modal-window.json b/source/_patterns/00-atoms/components/modal-window.json new file mode 100644 index 000000000..e06a2d232 --- /dev/null +++ b/source/_patterns/00-atoms/components/modal-window.json @@ -0,0 +1,5 @@ +{ + "title": "This is a title", + "closeBtnText": "Close", + "body": "This is some body text" +} From 0aca963ebd1c5c778222eb49c378b8bd905a5c91 Mon Sep 17 00:00:00 2001 From: Dave Price Date: Wed, 26 Jan 2022 09:33:00 +0000 Subject: [PATCH 11/60] Add yaml parameters for modal window --- .../00-atoms/components/modal-window.mustache | 7 ++++--- .../00-atoms/components/modal-window.yaml | 15 +++++++++++++++ 2 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 source/_patterns/00-atoms/components/modal-window.yaml diff --git a/source/_patterns/00-atoms/components/modal-window.mustache b/source/_patterns/00-atoms/components/modal-window.mustache index 7a67102c7..88e8944d5 100644 --- a/source/_patterns/00-atoms/components/modal-window.mustache +++ b/source/_patterns/00-atoms/components/modal-window.mustache @@ -1,10 +1,11 @@ diff --git a/source/_patterns/00-atoms/components/modal-window.yaml b/source/_patterns/00-atoms/components/modal-window.yaml new file mode 100644 index 000000000..bbfd62b90 --- /dev/null +++ b/source/_patterns/00-atoms/components/modal-window.yaml @@ -0,0 +1,15 @@ +$schema: http://json-schema.org/draft-04/schema# +type: object +properties: + title: + type: string + minLength: 1 + closeBtnText: + type: string + minLength: 1 + body: + type: string + minLength: 1 +required: + - closeBtnText + - body From a16bbbb16a909be082cea31c43d1f60ea13fc1a2 Mon Sep 17 00:00:00 2001 From: Dave Price Date: Thu, 27 Jan 2022 09:38:41 +0000 Subject: [PATCH 12/60] Add variations for modal window --- assets/js/components/Modal.js | 13 +++++++++---- .../_patterns/00-atoms/components/modal-window.json | 1 + .../00-atoms/components/modal-window.mustache | 3 +-- .../_patterns/00-atoms/components/modal-window.yaml | 2 ++ 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/assets/js/components/Modal.js b/assets/js/components/Modal.js index e92f93f32..7bdefad84 100644 --- a/assets/js/components/Modal.js +++ b/assets/js/components/Modal.js @@ -12,6 +12,7 @@ module.exports = class Modal { this.doc = doc; this.modalWindow = this.$elm.querySelector('.modal-container'); + this.smallDevice = this.$elm.querySelector('.small-device'); this.$elm.querySelector('.modal-click').addEventListener('click', (event) => this.modalToggle(event)); this.$elm.querySelector('.modal-content__button').addEventListener('click', (event) => this.modalToggle(event)); this.window.addEventListener('click', (event) => this.windowOnClick(event)); @@ -35,11 +36,15 @@ module.exports = class Modal { } modalSetup() { - if (this.window.innerWidth < 480) { - this.$elm.classList.remove('modal-nojs'); + if (this.$elm.classList.contains('small-device')) { + if (this.window.innerWidth < 480) { + this.$elm.classList.remove('modal-nojs'); + } else { + this.modalWindow.classList.remove('modal-content__show'); + this.$elm.classList.add('modal-nojs'); + } } else { - this.modalWindow.classList.remove('modal-content__show'); - this.$elm.classList.add('modal-nojs'); + this.$elm.classList.remove('modal-nojs'); } } diff --git a/source/_patterns/00-atoms/components/modal-window.json b/source/_patterns/00-atoms/components/modal-window.json index e06a2d232..c4ba79523 100644 --- a/source/_patterns/00-atoms/components/modal-window.json +++ b/source/_patterns/00-atoms/components/modal-window.json @@ -1,4 +1,5 @@ { + "smallDeviceOnly": "small-device", "title": "This is a title", "closeBtnText": "Close", "body": "This is some body text" diff --git a/source/_patterns/00-atoms/components/modal-window.mustache b/source/_patterns/00-atoms/components/modal-window.mustache index 88e8944d5..325a88911 100644 --- a/source/_patterns/00-atoms/components/modal-window.mustache +++ b/source/_patterns/00-atoms/components/modal-window.mustache @@ -1,6 +1,5 @@ -", "citations": true, "title": "Cite this article", "origin": "Nature 365:833–836.", From 30d43a3398470edb7db007d346d79b2cb728f011 Mon Sep 17 00:00:00 2001 From: Dave Price Date: Thu, 3 Feb 2022 15:53:12 +0000 Subject: [PATCH 22/60] Adding Clipboard JS for modal window share and citations --- assets/js/components/Modal.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/assets/js/components/Modal.js b/assets/js/components/Modal.js index 7bdefad84..bc2a87296 100644 --- a/assets/js/components/Modal.js +++ b/assets/js/components/Modal.js @@ -12,10 +12,11 @@ module.exports = class Modal { this.doc = doc; this.modalWindow = this.$elm.querySelector('.modal-container'); - this.smallDevice = this.$elm.querySelector('.small-device'); + this.clipboardButton = this.$elm.querySelector('.modal-content__clipboard-button'); this.$elm.querySelector('.modal-click').addEventListener('click', (event) => this.modalToggle(event)); this.$elm.querySelector('.modal-content__button').addEventListener('click', (event) => this.modalToggle(event)); this.window.addEventListener('click', (event) => this.windowOnClick(event)); + this.clipboardButton.addEventListener('click', () => this.clipboard()); this.window.addEventListener('resize', () => { this.modalSetup(); @@ -48,4 +49,12 @@ module.exports = class Modal { } } + clipboard() { + const text = this.$elm.querySelector('.modal-content__clipboard').textContent; + navigator.clipboard.writeText(text).then(() => { + this.clipboardButton.classList.add('button--success', 'button--fixed-width'); + this.clipboardButton.textContent = 'Copied!'; + }); + } + }; From 7811f62d5b4cb2605eb7495095763ad3ed9662f8 Mon Sep 17 00:00:00 2001 From: Dave Price Date: Thu, 3 Feb 2022 15:53:31 +0000 Subject: [PATCH 23/60] Add button success --- assets/sass/patterns/atoms/buttons.scss | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/assets/sass/patterns/atoms/buttons.scss b/assets/sass/patterns/atoms/buttons.scss index 8ef3d09a2..3c6ab07f3 100644 --- a/assets/sass/patterns/atoms/buttons.scss +++ b/assets/sass/patterns/atoms/buttons.scss @@ -106,3 +106,11 @@ cursor: not-allowed; } + +.button--success { + background-color: green; + + &:hover { + background-color: #2b7306; + } +} From 72a29744a954114a48531ac11985d700da48390e Mon Sep 17 00:00:00 2001 From: Dave Price Date: Fri, 4 Feb 2022 09:05:42 +0000 Subject: [PATCH 24/60] Button styling on modal windows --- assets/sass/patterns/atoms/buttons.scss | 22 ++++++++++++++++++- assets/sass/patterns/atoms/modal-window.scss | 11 ++++++---- .../00-atoms/components/modal-window.mustache | 2 +- 3 files changed, 29 insertions(+), 6 deletions(-) diff --git a/assets/sass/patterns/atoms/buttons.scss b/assets/sass/patterns/atoms/buttons.scss index 3c6ab07f3..a6164e624 100644 --- a/assets/sass/patterns/atoms/buttons.scss +++ b/assets/sass/patterns/atoms/buttons.scss @@ -26,6 +26,26 @@ text-transform: uppercase; } +.button-container { + display: block; + border: 1px solid black; + + .button { + @include margin(12, "bottom"); + width: 100%; + } + + @media only all and (min-width: #{get-rem-from-px($bkpt-site--medium)}em) { + grid-column: 1/3; + grid-row: 3; + + .button { + @include margin(12, "bottom"); + width: auto; + } + } +} + .button--default { @include colors($color-primary); @include padding(15 36 14); @@ -108,7 +128,7 @@ } .button--success { - background-color: green; + background-color: $color-success; &:hover { background-color: #2b7306; diff --git a/assets/sass/patterns/atoms/modal-window.scss b/assets/sass/patterns/atoms/modal-window.scss index dc46acb62..5729e734c 100644 --- a/assets/sass/patterns/atoms/modal-window.scss +++ b/assets/sass/patterns/atoms/modal-window.scss @@ -70,6 +70,10 @@ grid-column: 1/3; grid-row: 2; justify-self: initial; + + &.reference { + border: none; + } } .social-media-sharers { @@ -80,9 +84,8 @@ @include margin(36, "bottom"); grid-column: 1/3; grid-row: 3; -} -.button-container { - display: block; - grid-row: 3; + .button-container & { + @include margin(12, "bottom"); + } } diff --git a/source/_patterns/00-atoms/components/modal-window.mustache b/source/_patterns/00-atoms/components/modal-window.mustache index d52c6814d..173bb060a 100644 --- a/source/_patterns/00-atoms/components/modal-window.mustache +++ b/source/_patterns/00-atoms/components/modal-window.mustache @@ -3,7 +3,7 @@
", "title": "Cite this article" } diff --git a/source/_patterns/00-atoms/components/modal-window~share.json b/source/_patterns/00-atoms/components/modal-window~share.json index bddce71ac..d8a219789 100644 --- a/source/_patterns/00-atoms/components/modal-window~share.json +++ b/source/_patterns/00-atoms/components/modal-window~share.json @@ -1,5 +1,5 @@ { "title": "Share this article", "closeBtnText": " ", - "body": "
  1. Copy to clipboard
" + "body": "
" } diff --git a/source/_patterns/01-molecules/components/button-collection~citation-modal.json b/source/_patterns/01-molecules/components/button-collection~citation-modal.json index 4e307425b..0e437abf0 100644 --- a/source/_patterns/01-molecules/components/button-collection~citation-modal.json +++ b/source/_patterns/01-molecules/components/button-collection~citation-modal.json @@ -1,16 +1,19 @@ { "buttons": [ { + "type": "button", "text": "Copy to clipboard", "classes": "button--default", "path": "#" }, { + "type": "button", "text": "Download Bibtex", "classes": "button--default button--secondary", "path": "#" }, { + "type": "button", "text": "Download .RIS", "classes": "button--default button--secondary", "path": "#" From 590f0178cfc215cdc27ab1714c6e6611bd572298 Mon Sep 17 00:00:00 2001 From: nlisgo Date: Wed, 23 Feb 2022 20:27:46 +0000 Subject: [PATCH 54/60] Mock copyToClipboard method --- assets/js/components/ButtonClipboard.js | 7 +------ test/buttonclipboard.spec.js | 8 ++++---- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/assets/js/components/ButtonClipboard.js b/assets/js/components/ButtonClipboard.js index 18cbf04b4..906176b8c 100644 --- a/assets/js/components/ButtonClipboard.js +++ b/assets/js/components/ButtonClipboard.js @@ -7,20 +7,15 @@ module.exports = class Modal { } this.$elm = $elm; - this.copyFunction(this.copyToClipboard); this.$elm.addEventListener('click', () => { - this.$copy(this.$elm.getAttribute('data-clipboard'), () => { + this.copyToClipboard(this.$elm.getAttribute('data-clipboard'), () => { this.$elm.classList.add('button--success', 'button--fixed-width'); this.$elm.textContent = 'Copied!'; }); }); } - copyFunction(func) { - this.$copy = func; - } - copyToClipboard(text, onSuccess) { navigator.clipboard.writeText(text).then(onSuccess); } diff --git a/test/buttonclipboard.spec.js b/test/buttonclipboard.spec.js index fc8e1510e..25694b180 100644 --- a/test/buttonclipboard.spec.js +++ b/test/buttonclipboard.spec.js @@ -1,4 +1,5 @@ const chai = require('chai'); +const sinon = require('sinon'); const expect = chai.expect; @@ -15,10 +16,9 @@ describe('A button can be used to store text in clipboard', () => { $elm = document.querySelector('[data-behaviour="ButtonClipboard"]'); $clipboardText = ''; const btnClipboard = new ButtonClipboard($elm); - btnClipboard.copyFunction((text, onSuccess) => { - console.log('text copied!'); - $clipboardText = text; - onSuccess(); + sinon.stub(btnClipboard, 'copyToClipboard').callsFake((text, onSuccess) => { + $clipboardText = text; + onSuccess(); }); }); From 830db9360228f7282c53ac4123ca005817cc3e39 Mon Sep 17 00:00:00 2001 From: nlisgo Date: Wed, 23 Feb 2022 20:35:02 +0000 Subject: [PATCH 55/60] Add linkedInUrl to socialMediaSharers --- .../content-header~collection--title-0-xx-short.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/_patterns/02-organisms/content-headers/content-header~collection--title-0-xx-short.json b/source/_patterns/02-organisms/content-headers/content-header~collection--title-0-xx-short.json index 64ff93471..7b56fa545 100644 --- a/source/_patterns/02-organisms/content-headers/content-header~collection--title-0-xx-short.json +++ b/source/_patterns/02-organisms/content-headers/content-header~collection--title-0-xx-short.json @@ -24,9 +24,10 @@ }, "impactStatement": "From its earliest days, eLife has been publishing important advances in our understanding of Cancer Biology. Here, eLife Senior Editors present a collection of great papers spanning from oncogenes and tumor suppressors.", "socialMediaSharers": { + "emailUrl": "mailto:?subject=Some%20article%20title&body=https%3A%2F%2Fexample.com%2Fsome-article-url", "facebookUrl": "https://facebook.com/sharer/sharer.php?u=https%3A%2F%2Fexample.com%2Fsome-article-url", "twitterUrl": "https://twitter.com/intent/tweet/?text=Some%20article%20title&url=https%3A%2F%2Fexample.com%2Fsome-article-url", - "emailUrl": "mailto:?subject=Some%20article%20title&body=https%3A%2F%2Fexample.com%2Fsome-article-url", + "linkedInUrl": "https://www.linkedin.com/shareArticle?url=https%3A%2F%2Fexample.com%2Fsome-article-url", "redditUrl": "https://reddit.com/submit/?url=https%3A%2F%2Fexample.com%2Fsome-article-url" }, "meta": { From a7d77250f272c196d5969ce9a1165a0d335500ae Mon Sep 17 00:00:00 2001 From: nlisgo Date: Wed, 23 Feb 2022 20:41:49 +0000 Subject: [PATCH 56/60] match schema --- .../components/button-collection~citation-modal.json | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/source/_patterns/01-molecules/components/button-collection~citation-modal.json b/source/_patterns/01-molecules/components/button-collection~citation-modal.json index 0e437abf0..9e3ee29a5 100644 --- a/source/_patterns/01-molecules/components/button-collection~citation-modal.json +++ b/source/_patterns/01-molecules/components/button-collection~citation-modal.json @@ -3,20 +3,17 @@ { "type": "button", "text": "Copy to clipboard", - "classes": "button--default", - "path": "#" + "classes": "button--default" }, { "type": "button", "text": "Download Bibtex", - "classes": "button--default button--secondary", - "path": "#" + "classes": "button--default button--secondary" }, { "type": "button", "text": "Download .RIS", - "classes": "button--default button--secondary", - "path": "#" + "classes": "button--default button--secondary" } ] } From 4e5c79f7fb0480157a521f026d331a32183f9282 Mon Sep 17 00:00:00 2001 From: Dave Price Date: Thu, 24 Feb 2022 08:39:24 +0000 Subject: [PATCH 57/60] Removing as not anything to do with the project --- .vscode/settings.json | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index aef844305..000000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "liveServer.settings.port": 5501 -} \ No newline at end of file From ad77a7fd12311fa77d0aa66b274ed51ee0791c27 Mon Sep 17 00:00:00 2001 From: Dave Price Date: Thu, 24 Feb 2022 09:06:33 +0000 Subject: [PATCH 58/60] Refactor css for modal window --- assets/js/components/ButtonClipboard.js | 2 +- assets/sass/patterns/atoms/buttons.scss | 4 ---- assets/sass/patterns/atoms/modal-window.scss | 8 ++++++-- assets/sass/patterns/atoms/reference.scss | 1 + 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/assets/js/components/ButtonClipboard.js b/assets/js/components/ButtonClipboard.js index 906176b8c..91de0049e 100644 --- a/assets/js/components/ButtonClipboard.js +++ b/assets/js/components/ButtonClipboard.js @@ -10,7 +10,7 @@ module.exports = class Modal { this.$elm.addEventListener('click', () => { this.copyToClipboard(this.$elm.getAttribute('data-clipboard'), () => { - this.$elm.classList.add('button--success', 'button--fixed-width'); + this.$elm.classList.add('button--success', 'modal-content__clipboard-btn'); this.$elm.textContent = 'Copied!'; }); }); diff --git a/assets/sass/patterns/atoms/buttons.scss b/assets/sass/patterns/atoms/buttons.scss index e9df9041e..203a6e081 100644 --- a/assets/sass/patterns/atoms/buttons.scss +++ b/assets/sass/patterns/atoms/buttons.scss @@ -26,10 +26,6 @@ text-transform: uppercase; } -.button--fixed-width { - min-width: 189px; -} - .button--default { @include colors($color-primary); @include padding(15 36 14); diff --git a/assets/sass/patterns/atoms/modal-window.scss b/assets/sass/patterns/atoms/modal-window.scss index 2a8c71fa8..a49052e1b 100644 --- a/assets/sass/patterns/atoms/modal-window.scss +++ b/assets/sass/patterns/atoms/modal-window.scss @@ -77,8 +77,8 @@ .button { @include margin(12, "bottom"); + @include padding(15 24 14 24); line-height: 1.5; - padding: 15px 24px 14px; text-decoration: none; width: auto; } @@ -91,8 +91,8 @@ grid-column: 1/3; .button { + @include margin(24, "bottom"); justify-self: center; - margin-bottom: 24px; } } @@ -136,3 +136,7 @@ .social-media-sharers { display: flex; } + +.modal-content__clipboard-btn { + min-width: 189px; +} diff --git a/assets/sass/patterns/atoms/reference.scss b/assets/sass/patterns/atoms/reference.scss index 75c3a44df..325641daf 100644 --- a/assets/sass/patterns/atoms/reference.scss +++ b/assets/sass/patterns/atoms/reference.scss @@ -187,4 +187,5 @@ a.reference__authors_link:hover { } } + } From 815ecb4bf1e5cebf008a0f6b02e816482bb49141 Mon Sep 17 00:00:00 2001 From: Dave Price Date: Thu, 24 Feb 2022 09:12:25 +0000 Subject: [PATCH 59/60] Reverted back to previous --- source/_patterns/00-atoms/forms/text-field.json | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/source/_patterns/00-atoms/forms/text-field.json b/source/_patterns/00-atoms/forms/text-field.json index bbdb5c524..4228f8d34 100644 --- a/source/_patterns/00-atoms/forms/text-field.json +++ b/source/_patterns/00-atoms/forms/text-field.json @@ -1,5 +1,10 @@ { - - "inputType": "url", - "value": "https://doi.org/10.7554/eLife.09560" + "id": "emailAddress1", + "inputType": "email", + "label": { + "isVisuallyHidden": false, + "labelText": "Email Address" + }, + "name": "emailAddress", + "autofocus": true } From c85d97f46be924be62ef8198c5472e4cefd66dd1 Mon Sep 17 00:00:00 2001 From: nlisgo Date: Fri, 25 Feb 2022 16:47:33 +0000 Subject: [PATCH 60/60] remove file and redundant sass --- assets/img/icons/tick-white.svg | 10 ---------- assets/sass/patterns/atoms/modal-window.scss | 21 -------------------- 2 files changed, 31 deletions(-) delete mode 100644 assets/img/icons/tick-white.svg diff --git a/assets/img/icons/tick-white.svg b/assets/img/icons/tick-white.svg deleted file mode 100644 index 8bd3fe120..000000000 --- a/assets/img/icons/tick-white.svg +++ /dev/null @@ -1,10 +0,0 @@ - - - icons/tick-white - - - - - - - \ No newline at end of file diff --git a/assets/sass/patterns/atoms/modal-window.scss b/assets/sass/patterns/atoms/modal-window.scss index a49052e1b..a335a755a 100644 --- a/assets/sass/patterns/atoms/modal-window.scss +++ b/assets/sass/patterns/atoms/modal-window.scss @@ -116,27 +116,6 @@ visibility: hidden; } -.modal-content__clipboard { - @include margin(24, "bottom"); - @include padding(12); - border: 1px solid $color-text-dividers; - font-family: $font-secondary; - grid-column: 1/3; - grid-row: 2; - justify-self: initial; - word-break: break-word; - - &.reference { - @include margin(0, "bottom"); - border: none; - padding: 0; - } -} - -.social-media-sharers { - display: flex; -} - .modal-content__clipboard-btn { min-width: 189px; }