-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4e56e6d
commit 16c6fd1
Showing
5 changed files
with
305 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
.redesign-v2 .section.v2-social-block-container { | ||
padding: 40px 16px; | ||
} | ||
|
||
.v2-social-block-container { | ||
--social-block-padding: 24px 16px; | ||
--social-block-gap: 16px; | ||
--social-block-list-gap: 12px; | ||
} | ||
|
||
.v2-social-block { | ||
--social-link-color: var(--c-main-black); | ||
--social-text-color: var(--c-main-black); | ||
} | ||
|
||
.redesign-v2 .section .v2-social-block-wrapper { | ||
padding: var(--social-block-padding); | ||
border-radius: 8px; | ||
} | ||
|
||
.v2-social-block-wrapper--black { | ||
background-color: var(--c-main-black); | ||
} | ||
|
||
.v2-social-block--black { | ||
--social-link-color: var(--c-white); | ||
--social-text-color: var(--c-grey-2); | ||
} | ||
|
||
.v2-social-block-wrapper--gray { | ||
background-color: var(--c-grey-50); | ||
} | ||
|
||
.v2-social-block__list-wrapper { | ||
display: flex; | ||
flex-flow: column; | ||
gap: var(--social-block-gap); | ||
align-items: center; | ||
} | ||
|
||
.v2-social-block__title { | ||
font-family: var(--font-family-body); | ||
font-size: var(--f-heading-5-font-size); | ||
letter-spacing: var(--f-heading-5-letter-spacing); | ||
line-height: var(--f-heading-5-line-height); | ||
margin-bottom: 0; | ||
color: var(--social-text-color); | ||
} | ||
|
||
.v2-social-block__list { | ||
list-style-type: none; | ||
display: flex; | ||
} | ||
|
||
.v2-social-block__button:any-link { | ||
color: var(--social-link-color); | ||
background-color: transparent; | ||
align-items: center; | ||
display: inline-flex; | ||
font: var(--f-caption-font-size) / var(--f-caption-line-height) var(--font-family-body); | ||
letter-spacing: 0.4px; | ||
justify-content: center; | ||
max-width: 21.5em; | ||
height: 48px; | ||
padding: 0 var(--social-block-gap); | ||
border-radius: 4px; | ||
} | ||
|
||
.v2-social-block__button:focus-visible { | ||
outline: 2px solid var(--light-border-focus); | ||
outline-offset: 1px; | ||
} | ||
|
||
.v2-social-block__button .icon svg { | ||
height: 24px; | ||
width: 24px; | ||
} | ||
|
||
@media screen and (min-width: 744px) { | ||
.redesign-v2 .section.v2-social-block-container { | ||
padding: 40px 32px; | ||
} | ||
|
||
.v2-social-block-container { | ||
--social-block-padding: 32px; | ||
} | ||
|
||
.v2-social-block__list-wrapper { | ||
max-width: 680px; | ||
margin: auto; | ||
} | ||
|
||
.v2-social-block__list { | ||
gap: 16px; | ||
} | ||
} | ||
|
||
@media screen and (min-width: 1200px) { | ||
.redesign-v2 .section.v2-social-block-container { | ||
padding: 48px 0; | ||
} | ||
|
||
.v2-social-block-container { | ||
--social-block-padding: 48px 40px; | ||
--social-block-gap: 32px; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
import { getTextLabel, unwrapDivs, variantsClassesToBEM } from '../../scripts/common.js'; | ||
|
||
export default async function decorate(block) { | ||
const blockName = 'v2-social-block'; | ||
const variantClasses = ['black', 'gray']; | ||
|
||
if (block.classList.contains('black')) { | ||
block.parentElement.classList.add('v2-social-block-wrapper--black'); | ||
} else if (block.classList.contains('gray')) { | ||
block.parentElement.classList.add('v2-social-block-wrapper--gray'); | ||
} | ||
|
||
variantsClassesToBEM(block.classList, variantClasses, blockName); | ||
|
||
const headings = block.querySelectorAll('h1, h2, h3, h4, h5, h6'); | ||
[...headings].forEach((heading) => heading.classList.add(`${blockName}__title`)); | ||
|
||
const socialWrapper = block.querySelector(':scope > div'); | ||
socialWrapper.classList.add(`${blockName}__list-wrapper`); | ||
|
||
const list = socialWrapper.querySelector('ul'); | ||
let copyAnchor; | ||
|
||
list.classList.add(`${blockName}__list`); | ||
list.classList.remove('cta-list'); | ||
|
||
[...list.children].forEach((item) => { | ||
item.className = ''; | ||
|
||
const anchor = item.querySelector('a'); | ||
if (anchor) { | ||
anchor.className = `${blockName}__button`; | ||
} | ||
|
||
const copyLink = item.querySelector('.icon-link'); | ||
if (copyLink) { | ||
copyAnchor = anchor; | ||
anchor.dataset.tooltip = getTextLabel('Copied'); | ||
|
||
anchor.addEventListener('click', async (e) => { | ||
e.preventDefault(); | ||
try { | ||
await navigator.clipboard.writeText(`${anchor.href}`); | ||
anchor.classList.add('show'); | ||
|
||
setTimeout(() => { | ||
anchor.classList.remove('show'); | ||
}, 1000); | ||
} catch (err) { | ||
/* eslint-disable-next-line no-console */ | ||
console.error('Failed to copy: ', err); | ||
} | ||
}); | ||
anchor.classList.add('tooltip', 'tooltip--top'); | ||
} | ||
}); | ||
unwrapDivs(block); | ||
|
||
const mobileMQ = window.matchMedia('(max-width: 743px)'); | ||
const tabletMQ = window.matchMedia('(min-width: 744px)'); | ||
|
||
function onMobileChange() { | ||
copyAnchor.classList.remove('tooltip--right'); | ||
copyAnchor.classList.add('tooltip--top'); | ||
} | ||
|
||
function onTabletChange() { | ||
copyAnchor.classList.remove('tooltip--top'); | ||
copyAnchor.classList.add('tooltip--right'); | ||
} | ||
|
||
if (mobileMQ.matches) { | ||
onMobileChange(mobileMQ); | ||
} | ||
|
||
if (tabletMQ.matches) { | ||
onTabletChange(tabletMQ); | ||
} | ||
|
||
window.addEventListener('resize', () => { | ||
if (mobileMQ.matches) { | ||
onMobileChange(); | ||
} else if (tabletMQ.matches) { | ||
onTabletChange(); | ||
} | ||
}); | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters