Skip to content

Commit

Permalink
styles: updates the home page (#93)
Browse files Browse the repository at this point in the history
* gives proper text color to a completed and active task

* refactor: css

* updated the home page

* modifiend ui

* made the homepage responsive

* refactor: rename component

* refactor: use CSS grids

* refactor: styles

* format: files

* styles: fix gap

---------

Co-authored-by: JeelRajodiya <[email protected]>
  • Loading branch information
pavanydg and JeelRajodiya authored Oct 9, 2024
1 parent a7678e3 commit 888447a
Show file tree
Hide file tree
Showing 12 changed files with 101 additions and 75 deletions.
2 changes: 1 addition & 1 deletion app/components/CertificateButton/index.tsx
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export {default as default} from './CertificateButton';
export { default as default } from "./CertificateButton";
6 changes: 3 additions & 3 deletions app/components/CommunityLinks/CommunityLinks.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
position: relative;
}
.footerLink {
color: hsl(var(--primary));
color: hsl(var(--text));
text-decoration: underline;
text-underline-offset: 0.15em;
text-decoration-color: hsl(var(--primary) / 0.3);
text-decoration-color: hsl(var(--primary) / 0.5);
}

.footerLink:hover {
text-decoration-color: hsl(var(--primary));
text-decoration-color: hsl(var(--text));
}
8 changes: 8 additions & 0 deletions app/components/HomePageLinks/HomePageLinks.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/* grid of 4 rows */
.HomePageLinks {
display: grid;
grid-template-rows: repeat(4, 1fr);
gap: 8px;
column-gap: 32px;
grid-auto-flow: column;
}
40 changes: 40 additions & 0 deletions app/components/HomePageLinks/HomePageLinks.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { contentManager } from "@/lib/contentManager";
import styles from "./HomePageLinks.module.css";
import Link from "next/link";
import { useMemo } from "react";
import CommunityLinksStyles from "@/app/components/CommunityLinks/CommunityLinks.module.css";

export default function HomePageLinks() {
const outline = contentManager.getOutline();
const totalChapters = contentManager.getTotalChapters();
const chapterInfo: {
title: string;
link: string;
}[] = useMemo(() => {
const chapterInfo = [];
for (let i = 0; i < totalChapters; i++) {
const chapter = outline[i];
chapterInfo.push({
title: chapter.title,
link: contentManager.getPathWithPrefix(
chapter.steps[0].fullPath,
) as string,
});
}
return chapterInfo;
}, []);

return (
<div className={styles.HomePageLinks}>
{chapterInfo.map((chapter, index) => (
<Link
key={index}
href={chapter.link}
className={CommunityLinksStyles.footerLink}
>
{index + 1}. {chapter.title}
</Link>
))}
</div>
);
}
1 change: 1 addition & 0 deletions app/components/HomePageLinks/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default as default } from "./HomePageLinks";
5 changes: 2 additions & 3 deletions app/components/OutlineDrawer/OutlineDrawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,9 @@ export default function OutlineDrawer({
<DrawerContent>
<DrawerCloseButton />
<DrawerHeader display={"flex"} justifyContent={"space-between"}>

Outline
<CertificateButton />
</DrawerHeader>
<CertificateButton />
</DrawerHeader>

<DrawerBody>
<nav>
Expand Down
41 changes: 15 additions & 26 deletions app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,42 +1,31 @@
import styles from "./styles/page.module.css";
import Link from "next/link";
import cx from "classnames";
import { interFont, outfitFont } from "./styles/fonts";
import RightArrow from "./styles/icons/RightArrow";
import CompanyLogos from "./components/CommunityLinks/CommunityLinks";
import { contentManager } from "@/lib/contentManager";
import HomePageLinks from "./components/HomePageLinks/HomePageLinks";
import { Flex } from "@chakra-ui/react";

export default function Home() {
const outline = contentManager.getOutline();
return (
<div className={cx(styles.main, outfitFont.className)}>
<div className={styles.wrapper}>
<div className={styles.titleWrapper}>
<div className={styles.title}>
<div>A Tour of</div>
<div className={styles.jsonSchemaTitle}>JSON Schema</div>
</div>
<div className={styles.subtitleWrapper}>
<div className={styles.subtitle1}>
Build more. Break less. Empower others.
<div className={styles.backgroundClipWrapper}>
<div className={styles.titleWrapper}>
<div className={styles.title}>
<div>A Tour of</div>
<div className={styles.jsonSchemaTitle}>JSON Schema</div>
</div>
<div className={styles.subtitle2}>
Ensure confident & reliable use of JSON data with JSON Schema
<div className={styles.subtitleWrapper}>
<div className={styles.subtitle1}>
Build more. Break less. Empower others.
</div>
<div className={styles.subtitle2}>
Ensure confident & reliable use of JSON data with JSON Schema
</div>
</div>
</div>
</div>
<Link
href={
contentManager.getPathWithPrefix(
outline[0].steps[0].fullPath,
) as string
}
>
<button className={styles.mainBtn}>
START NOW
<RightArrow />
</button>
</Link>
<HomePageLinks />
</div>
<div className={styles.footer}>
<div className={cx(styles.footerText, interFont.className)}>
Expand Down
1 change: 1 addition & 0 deletions app/styles/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ html {
--primary: var(--primary-light);
--error: var(--error-light);
--success: var(--success-light);
--backgroundImage: var(--backgroundImage-light);
}

/* html[data-theme="dark"] svg {
Expand Down
53 changes: 19 additions & 34 deletions app/styles/page.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,44 +3,54 @@
flex-direction: column;
height: inherit;

justify-content: space-between;
align-items: center;
}

.wrapper {
display: flex;
flex-direction: column;
height: 100%;
gap: 64px;
justify-content: center;
width: 100%;
align-items: center;
}

.backgroundClipWrapper {
display: flex;
flex-direction: column;
background: hsl(var(--primary));
clip-path: polygon(0 0, 0 100%, 0% 100%, 100% 75%, 100% 0);
color: white;
height: max-content;
width: 100%;
padding-top: 64px;
padding-bottom: 96px;

align-items: center;
}

.titleWrapper {
display: flex;
flex-direction: column;
gap: 8px;
margin-right: 5em;

/* justify-content: center; */
/* align-items: center; */
}
.title {
font-size: 6rem;
font-size: 5rem;
font-weight: 900;
display: flex;
flex-direction: column;
gap: 0px;
text-shadow: 4px 4px 2px rgba(0, 0, 0, 0.25);
}

.title > div {
line-height: 115%;
letter-spacing: -2px;
}
.jsonSchemaTitle {
color: hsl(var(--primary));
text-decoration: underline;
text-decoration-thickness: 0.075em;
/* add some gap between the underline and text */

text-underline-offset: 0.15em;
}
.subtitle1 {
Expand All @@ -52,8 +62,6 @@
}
.subtitle2 {
font-size: 1.3rem;

color: hsl(var(--text) / 0.5);
}
.subtitleWrapper {
display: flex;
Expand All @@ -62,29 +70,6 @@
justify-content: center;
}

.mainBtn {
font-weight: 800;
font-size: 1.4em;
background-color: hsl(var(--primary));
color: white;
display: flex;
justify-self: center;
align-items: center;
gap: 8px;
padding: 8px 14px;
border-radius: 8px;
transition:
gap 0.2s,
padding 0.2s;
box-shadow: 3px 3px 2px rgba(0, 0, 0, 0.25);
padding-right: 18px;
}

.mainBtn:hover {
gap: 24px;
padding: 8px 18px;
}

.footer {
display: flex;
flex-direction: column;
Expand Down
8 changes: 4 additions & 4 deletions app/styles/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,10 @@ const Modal = {
dialog: {
bg: "hsl(var(--background))",
color: "hsl(var(--text))",
borderRadius: "16px"
}
}
}
borderRadius: "16px",
},
},
};

export const theme = extendTheme({
config: {
Expand Down
8 changes: 5 additions & 3 deletions lib/client-functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,15 @@ export function isChapterCompleted(chapterIndex: number, totalSteps: number) {
return true;
}


export function isTheTourCompleted() {
const totalStepsForAllChapters = contentManager.getNumberOfStepsFromAllChapters();
const totalStepsForAllChapters =
contentManager.getNumberOfStepsFromAllChapters();
if (!localStorage.getItem("progress")) {
return false;
}
const completedSteps = Object.keys(JSON.parse(localStorage.getItem("progress")!)).length;
const completedSteps = Object.keys(
JSON.parse(localStorage.getItem("progress")!),
).length;
return totalStepsForAllChapters === completedSteps;
}

Expand Down
3 changes: 2 additions & 1 deletion lib/contentVariables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ export const contentFolderPath: string = "./content";
export const contentFolderName: string = contentFolderPath.replace("./", "");
export const indexFileName = "index.mdx";
export const instructionsFileName = "instructions.mdx";
export const googleSheetAPIRoute = "https://script.google.com/macros/s/AKfycbxjH778iyBlZ8_oY946fTLW6H0HcfByaNk0collEgIwERwnpeErkaYEuKjWxAQ2qg/exec"
export const googleSheetAPIRoute =
"https://script.google.com/macros/s/AKfycbxjH778iyBlZ8_oY946fTLW6H0HcfByaNk0collEgIwERwnpeErkaYEuKjWxAQ2qg/exec";

0 comments on commit 888447a

Please sign in to comment.