Skip to content

Commit a5402ea

Browse files
authored
Merge pull request #204 from HackMelbourne/fix/hero-title-removing-tailwind
Fix/hero title removing tailwind
2 parents c77e6a7 + b99fa07 commit a5402ea

3 files changed

Lines changed: 108 additions & 37 deletions

File tree

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
.hero-container {
2+
display: flex;
3+
justify-content: center;
4+
align-items: center;
5+
flex-direction: column;
6+
}
7+
8+
.hero-bigtext {
9+
/* position: relative; */
10+
display: flex;
11+
flex-direction: column;
12+
justify-content: flex-end;
13+
flex-basis: auto
14+
}
15+
16+
.hero-background {
17+
z-index: -10;
18+
color: transparent;
19+
-webkit-text-stroke: 1px #767676;
20+
font-weight: 900;
21+
font-size: 9rem;
22+
white-space: nowrap;
23+
line-height: 1;
24+
margin-bottom: -100px;
25+
/* padding-bottom: 5rem; */
26+
-webkit-mask-image: linear-gradient(to bottom, black 50%, transparent 100%);
27+
mask-image: linear-gradient(to bottom, black 50%, transparent 100%);
28+
}
29+
30+
@media (min-width: 768px) {
31+
.hero-background {
32+
font-size: 16rem; /* md:text-[256px] */
33+
}
34+
}
35+
36+
@media (min-width: 768px) {
37+
.hero-content {
38+
align-items: center;
39+
gap: 1.25rem;
40+
}
41+
}
42+
43+
.hero-title {
44+
z-index: 1;
45+
font-weight: 900;
46+
font-size: 3rem; /* text-5xl */
47+
line-height: 1;
48+
white-space: nowrap;
49+
text-align: center;
50+
/* position: absolute;
51+
bottom: 5.5rem; */
52+
}
53+
54+
@media (min-width: 768px) {
55+
.hero-title {
56+
font-size: 4.5rem; /* md:text-7xl */
57+
}
58+
}
59+
60+
@media (min-width: 1024px) {
61+
.hero-title {
62+
font-size: 6rem; /* lg:text-[96px] */
63+
}
64+
}
65+
66+
.hero-description {
67+
max-width: 40%;
68+
margin-top: 2rem;
69+
}
70+
71+
@media (max-width: 767px) {
72+
.hero-description {
73+
max-width: 100%;
74+
}
75+
}

src/features/TitleHero/TitleHero.tsx

Lines changed: 29 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { useEffect, useRef } from "react";
22
import { motion } from "framer-motion";
3+
import "./TitleHero.css";
34

45
interface PageHeader {
56
pageTitle: string;
@@ -10,44 +11,39 @@ const TitleHero = ({ pageTitle, pageDescription }: PageHeader) => {
1011
const ref = useRef<HTMLDivElement>(null);
1112

1213
return (
13-
<div className="grid grid-cols-1 grid-rows-1 items-center md:mt-10 relative overflow-clip">
14-
{/* Background */}
15-
<div
16-
className="col-start-1 row-start-1 absolute -z-10 stroke-width text-9xl font-black md:text-[256px] whitespace-nowrap left-1/2"
17-
style={{
18-
color: "transparent",
19-
WebkitTextStrokeColor: "#767676",
20-
}}
21-
ref={ref}>
14+
<div className="hero-container">
15+
<div className="hero-bigtext">
16+
{/* Background Text */}
2217
<motion.div
23-
className=" relative -left-1/2"
24-
initial={{ opacity: 0, letterSpacing: "20rem", textIndent: "20rem" }}
25-
whileInView={{ opacity: 1, letterSpacing: "0px", textIndent: "0px" }}
18+
className="hero-background"
19+
initial={{ opacity: 0 }}
20+
whileInView={{ opacity: 1 }}
2621
transition={{ delay: 0.4, duration: 0.8, ease: "anticipate", type: "tween" }}
27-
viewport={{ once: true }}>
22+
viewport={{ once: true }}
23+
>
2824
{pageTitle}
2925
</motion.div>
26+
27+
{/* Foreground Content */}
28+
<motion.div
29+
className="hero-title"
30+
initial={{ opacity: 0, letterSpacing: "20rem", textIndent: "20rem" }}
31+
whileInView={{ opacity: 1, letterSpacing: "0px", textIndent: "0px" }}
32+
transition={{ duration: 1.2, ease: "anticipate", type: "tween" }}
33+
viewport={{ once: true }}
34+
>
35+
<h1>{pageTitle}</h1>
36+
</motion.div>
3037
</div>
31-
{/* Foreground */}
32-
<div className="col-start-1 row-start-1 pt-48 px-8 j">
33-
<div className="justify-self-center flex flex-col gap-3 md:items-center md:gap-5">
34-
<motion.div
35-
className="z-1 text-5xl font-black md:text-7xl lg:text-[96px] md:whitespace-nowrap"
36-
initial={{ opacity: 0, letterSpacing: "20rem", textIndent: "20rem" }}
37-
whileInView={{ opacity: 1, letterSpacing: "0px", textIndent: "0px" }}
38-
transition={{ duration: 1.2, ease: "anticipate", type: "tween" }}
39-
viewport={{ once: true }}>
40-
<h1>{pageTitle}</h1>
41-
</motion.div>
42-
<motion.div
43-
className="md:w-2/5"
44-
initial={{ opacity: 0, y: -40 }}
45-
animate={{ opacity: 1, y: 0 }}
46-
transition={{ delay: 1 }}>
47-
<p>{pageDescription}</p>
48-
</motion.div>
49-
</div>
50-
</div>
38+
39+
<motion.div
40+
className="hero-description"
41+
initial={{ opacity: 0, y: -40 }}
42+
animate={{ opacity: 1, y: 0 }}
43+
transition={{ delay: 1 }}
44+
>
45+
<p>{pageDescription}</p>
46+
</motion.div>
5147
</div>
5248
);
5349
};

src/layouts/Layout.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,10 @@ const Layout = () => {
144144

145145
return (
146146
<>
147-
<div className="w-screen max-w-full overflow-x-clip">
148-
{isShowNavbar ? (
149-
<Navbar clubname={nav.clubname} logo={nav.logo} pages={nav.pages} links={nav.links} pills={nav.pills} />
150-
) : null}
147+
{isShowNavbar ? (
148+
<Navbar clubname={nav.clubname} logo={nav.logo} pages={nav.pages} links={nav.links} pills={nav.pills} />
149+
) : null}
150+
<div className="pt-[100px] w-screen max-w-full overflow-x-clip">
151151
<Outlet />
152152
{isShowFooter ? <Footer links={footer.links} icons={footer.icons} /> : null}
153153

0 commit comments

Comments
 (0)