Skip to content

Commit

Permalink
Merge pull request #46 from unixMiB/feature/improve-hero-background
Browse files Browse the repository at this point in the history
Improve hero background
  • Loading branch information
kowalski7cc authored Oct 23, 2023
2 parents ec21dc9 + c24dced commit 4dc9df4
Show file tree
Hide file tree
Showing 5 changed files with 111 additions and 92 deletions.
180 changes: 106 additions & 74 deletions src/components/hero.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import Button from "react-bootstrap/Button";
import Container from "react-bootstrap/Container";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { icon } from "@fortawesome/fontawesome-svg-core/import.macro";
import Alert from "react-bootstrap/Alert";
// import Alert from "react-bootstrap/Alert";
import { StaticImage } from "gatsby-plugin-image";

const Hero = ({ small }) => {
const data = useStaticQuery(
Expand Down Expand Up @@ -36,9 +37,35 @@ const Hero = ({ small }) => {
const metadata = data.site.siteMetadata;

return (
<div className='hero'>
<Container>
{/* {small && (
<div
style={{
position: "relative",
color: "black",
}}
>
<StaticImage
style={{
filter: "brightness(0.4)",
position: "absolute",
top: 0,
left: 0,
width: "100%",
height: "100%",
zIndex: -1,
}}
src='../assets/images/hero.jpg'
formats={["auto", "avif", "webp"]}
layout='fullWidth'
aspectRatio={3 / 1}
/>
<div
style={{
position: "relative",
zIndex: 1,
}}
>
<Container className='hero'>
{/* {small && (
<Alert variant='warning'>
<Alert.Heading>
<FontAwesomeIcon
Expand Down Expand Up @@ -66,77 +93,82 @@ const Hero = ({ small }) => {
</p>
</Alert>
)} */}
<h1 style={{ textTransform: "uppercase" }} className='mb-0 title'>
Linux Day Milano <span className='ldmi'>{metadata.event.year}</span>
</h1>
<h4 className='pb-3 pb-sm-5 title'>
<small>
organizzato da{" "}
<a
title='Scopri di più su unixMiB'
href={metadata.contacts.website}
target='_blank'
className='unixmib text-white'
rel='noopener noreferrer'
>
<span className='unix'>unix</span>
<span className='mib'>MiB</span>
</a>
</small>
</h4>
<div className='subtitle'>
<FontAwesomeIcon
icon={icon({ name: "calendar", family: "classic", style: "solid" })}
/>{" "}
{metadata.event.text}
<br />
<FontAwesomeIcon
icon={icon({ name: "clock", family: "classic", style: "solid" })}
/>{" "}
Ore {metadata.event.time}
<br />
<FontAwesomeIcon
icon={icon({
name: "map-marked-alt",
family: "classic",
style: "solid",
})}
/>{" "}
{metadata.contacts.place.name}
<br />
<FontAwesomeIcon
icon={icon({
name: "chevron-right",
family: "classic",
style: "solid",
})}
/>{" "}
{metadata.contacts.place.building}
<br />
</div>
{small && (
<div className='mt-5 gx-5 d-flex flex-wrap justify-content-start clearfix'>
<Button
href='/#explore'
size='lg'
className='m-1'
variant='warning'
>
Scopri di più
</Button>
<Button
href='/schedule'
size='lg'
className='m-1'
variant='warning'
>
{metadata.switches.schedule
? "Guarda il programma"
: "Programma precedente"}
</Button>
<h1 style={{ textTransform: "uppercase" }} className='mb-0 title'>
Linux Day Milano <span className='ldmi'>{metadata.event.year}</span>
</h1>
<h4 className='pb-3 pb-sm-5 title'>
<small>
organizzato da{" "}
<a
title='Scopri di più su unixMiB'
href={metadata.contacts.website}
target='_blank'
className='unixmib text-white'
rel='noopener noreferrer'
>
<span className='unix'>unix</span>
<span className='mib'>MiB</span>
</a>
</small>
</h4>
<div className='subtitle'>
<FontAwesomeIcon
icon={icon({
name: "calendar",
family: "classic",
style: "solid",
})}
/>{" "}
{metadata.event.text}
<br />
<FontAwesomeIcon
icon={icon({ name: "clock", family: "classic", style: "solid" })}
/>{" "}
Ore {metadata.event.time}
<br />
<FontAwesomeIcon
icon={icon({
name: "map-marked-alt",
family: "classic",
style: "solid",
})}
/>{" "}
{metadata.contacts.place.name}
<br />
<FontAwesomeIcon
icon={icon({
name: "chevron-right",
family: "classic",
style: "solid",
})}
/>{" "}
{metadata.contacts.place.building}
<br />
</div>
)}
</Container>
{small && (
<div className='mt-5 gx-5 d-flex flex-wrap justify-content-start clearfix'>
<Button
href='/#explore'
size='lg'
className='m-1'
variant='warning'
>
Scopri di più
</Button>
<Button
href='/schedule'
size='lg'
className='m-1'
variant='warning'
>
{metadata.switches.schedule
? "Guarda il programma"
: "Programma precedente"}
</Button>
</div>
)}
</Container>
</div>
</div>
);
};
Expand Down
10 changes: 5 additions & 5 deletions src/pages/schedule.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -215,10 +215,6 @@ const Page = ({ data }) => {

useEffect(() => {
let current = localStorage.getItem("starredTalks");
let showStarred = localStorage.getItem("showStarred");
if (showStarred === "true") {
setShowStarred(true);
}
if (current) {
try {
current = JSON.parse(current);
Expand All @@ -230,6 +226,7 @@ const Page = ({ data }) => {
setStarredTalks({});
}
}
localStorage.getItem("showStarred") === "true" && setShowStarred(true);
}, []);

useEffect(() => {
Expand Down Expand Up @@ -260,7 +257,10 @@ const Page = ({ data }) => {
<div className='d-flex flex-row gap-3 d-print-none'>
<Button
variant='warning'
onClick={() => {setShowStarred((curr) => !curr); localStorage.setItem("showStarred", !showStarred)}}
onClick={() => {
setShowStarred((curr) => !curr);
localStorage.setItem("showStarred", !showStarred);
}}
>
{showStarred ? "Tutte le talk" : "Agenda personale"}
</Button>
Expand Down
10 changes: 0 additions & 10 deletions src/styles/base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,6 @@ html {
color: $unixmib;
}

@mixin cover-background($imageUrl, $overlay) {
@if $overlay {
background: linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.6)),
url($imageUrl) no-repeat center center fixed;
} @else {
background: url($imageUrl) no-repeat center center fixed;
}
background-size: cover;
}

@mixin tshadow() {
text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}
Expand Down
1 change: 0 additions & 1 deletion src/styles/components/hero.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
.hero {
@include cover-background("../assets/images/hero.jpg", true);

@include media-breakpoint-up(md) {
padding: 3rem 4rem 5rem;
Expand Down
2 changes: 0 additions & 2 deletions src/styles/pages/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,6 @@
&#sponsors {
background-color: white; //#1881a2;
color: black;
//@include cover-background("../assets/images/sponsor-bg.jpg", true);
//background-image: url("../assets/images/sponsor-bg.jpg");
background-position: 50% 0;
background-size: cover;
padding-top: 0;
Expand Down

0 comments on commit 4dc9df4

Please sign in to comment.