-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Daniele T <[email protected]> Co-authored-by: Fabio Bonelli <[email protected]>
- Loading branch information
1 parent
890b6b2
commit 7790cc0
Showing
558 changed files
with
2,394 additions
and
1,691 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import React from "react"; | ||
import Button from "../button/button"; | ||
|
||
export const isBrowser = () => typeof window !== "undefined"; | ||
|
||
const isServiceRemembered = (serviceKey) => { | ||
const services = isBrowser() | ||
? JSON.parse(localStorage.getItem("bs-ck3") || "{}") | ||
: {}; | ||
return services[serviceKey]; | ||
}; | ||
|
||
const isPreferencesSet = () => { | ||
const services = isBrowser() | ||
? JSON.parse(localStorage.getItem("bs-ck3") || "{}") | ||
: {}; | ||
for (const service in services) { | ||
if (services[service] === true) { | ||
return true; | ||
} | ||
} | ||
return false; | ||
}; | ||
|
||
function CookieRemove({ cookies }) { | ||
const cookieItems = cookies.map( | ||
(cookie) => | ||
isServiceRemembered(cookie.key) && ( | ||
<div className="row mt-4" key={cookie.key}> | ||
<div className="col-12 col-md-6 mt-md-1 mb-3 mb-lg-0 fw-semibold"> | ||
<span>{cookie.label}</span> | ||
</div> | ||
<div className="col-12 col-md-6"> | ||
<Button | ||
btnStyle="outline-primary btn-xs" | ||
onClick={() => { | ||
localStorage.removeItem("bs-ck3"); | ||
window.location.reload(); | ||
}} | ||
aria-label="{accordionSrCopyLabel}" | ||
> | ||
Revoca | ||
</Button> | ||
</div> | ||
</div> | ||
), | ||
); | ||
return ( | ||
<div className="text-image-cta d-flex mb-5"> | ||
<div className="content w-100"> | ||
{isBrowser() && isPreferencesSet() ? ( | ||
<div> | ||
<p> | ||
Hai acconsentito a installare i seguenti cookie di terze parti: | ||
</p> | ||
{cookieItems} | ||
</div> | ||
) : ( | ||
<div> | ||
<p>Non hai installato cookie di terze parti.</p> | ||
</div> | ||
)} | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
export default CookieRemove; |
106 changes: 106 additions & 0 deletions
106
src/components/list-archive-media/list-archive-media.js
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,106 @@ | ||
import * as React from "react"; | ||
|
||
import "../../scss/styles.scss"; | ||
import "../../js/globals"; | ||
|
||
import { useStaticQuery, graphql } from "gatsby"; | ||
import classNames from "classnames"; | ||
import Card from "../card/card"; | ||
|
||
function ListArchiveMedia({ background, noSpace }) { | ||
const data = useStaticQuery(graphql` | ||
query { | ||
allContent( | ||
filter: { metadata: { archive: { in: "media" } } } | ||
sort: { seo: { pathname: DESC } } | ||
) { | ||
totalCount | ||
edges { | ||
node { | ||
id | ||
metadata { | ||
template { | ||
name | ||
} | ||
} | ||
components { | ||
hero { | ||
title | ||
subtitle | ||
tag { | ||
label | ||
} | ||
} | ||
} | ||
seo { | ||
description | ||
pathname | ||
image | ||
} | ||
} | ||
} | ||
} | ||
} | ||
`); | ||
|
||
const { edges } = data.allContent; | ||
const tagHeader = "Esplora l’archivio"; | ||
|
||
const styles = classNames("section-editorial", { | ||
[`bg-${background}`]: background, | ||
"py-0": noSpace, | ||
"text-white": background === "dark", | ||
}); | ||
|
||
const cardStyles = "col-12 col-md-6 mb-3 mb-md-4 col-lg-4"; | ||
|
||
const iconOverlay = { | ||
icon: "sprites.svg#it-video", | ||
ariaLabel: "video", | ||
}; | ||
|
||
return ( | ||
<section className={styles} aria-describedby="archive-list-title"> | ||
<div className="container-xxl"> | ||
<div className="row"> | ||
<div className="col-12 g-0"> | ||
<div className="px-3 px-lg-0 px-lg-5"> | ||
<h2 | ||
className="border-bottom pb-4 mb-4 mb-md-5" | ||
id="archive-list-title" | ||
> | ||
{tagHeader} | ||
</h2> | ||
<div className="row pb-4"> | ||
{edges.map(({ node }) => { | ||
const { id } = node; | ||
const { pathname } = node.seo; | ||
const { title } = node.components?.hero || ""; | ||
const { tag } = node.components?.hero || ""; | ||
const { image } = node.seo; | ||
return ( | ||
<div className={cardStyles} key={id}> | ||
<Card | ||
title={title} | ||
url={pathname} | ||
cardEvent="true" | ||
img={image} | ||
alt="" | ||
imgRatio="21x9" | ||
fullHeight="true" | ||
tag={tag} | ||
iconOverlay={iconOverlay} | ||
/> | ||
</div> | ||
); | ||
})} | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</section> | ||
); | ||
} | ||
|
||
export default ListArchiveMedia; |
Oops, something went wrong.