-
Notifications
You must be signed in to change notification settings - Fork 1
feat: add Guides page #113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
BIA3IA
wants to merge
15
commits into
main
Choose a base branch
from
bianca/guides
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
cb465dc
feat: add GuidePage and CardText component for guide display
BIA3IA 197ee15
feat: implement GuideContent and GuideHero components for guide display
BIA3IA af078c6
refactor: biome check
BIA3IA 9842073
feat: add Hero component and integrate it into Associations, Communit…
BIA3IA f2f6ea3
feat: remove unused CarouselMock component from Home page
BIA3IA c77ef1d
style: format Hero component for improved readability
BIA3IA 184b538
Merge commit '68e769ee4f948e11bfc8ab150bbe06f693bf8490' into bianca/g…
BIA3IA 78c28e0
Merge commit 'c77ef1d8fdf746a62799180d09261fac9b3af2ad' into bianca/g…
BIA3IA 609632f
feat: replace GuideHero component with Hero component in GuidePage
BIA3IA f260477
feat: add CardResource component and enhance GuideContent with classN…
BIA3IA 4a6c438
feat: add GuideContentMobile component and update GuidePage to use it
BIA3IA a6cc210
feat: enhance CardResource component to support Pill tags and add Pil…
BIA3IA 069cacf
fix: correct formatting in guidesInfoMobile and add className prop to…
BIA3IA c1e619e
chore: biome
BIA3IA 6ffa8e2
chore: rabbit
BIA3IA File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,105 @@ | ||
| import { FiLogIn } from "react-icons/fi" | ||
| import { CardCaption } from "@/components/card-caption" | ||
| import type { CardResourceProps } from "@/components/card-resource/types" | ||
| import GuideContent from "@/components/guides/content" | ||
| import { GuideContentMobile } from "@/components/guides/content-mobile" | ||
| import { Hero } from "@/components/ui/hero" | ||
|
|
||
| const guidesInfo = { | ||
| title: "Le guide per Ingegneria Informatica", | ||
| description: "Rimani aggiornato sulle idee appena condivise dagli studenti del Politecnico", | ||
| guides: [ | ||
| { | ||
| text: "Corsi a scelta Primo Anno", | ||
| }, | ||
| { | ||
| text: "Corsi a scelta Secondo Anno", | ||
| }, | ||
| { | ||
| text: "Corsi a scelta Terzo Anno", | ||
| }, | ||
| ], | ||
| } | ||
|
|
||
| const guidesGeneral = { | ||
| title: "Le guide generali", | ||
| description: "Consulta le guide generali per orientarti al meglio nella vita universitaria", | ||
| guides: [ | ||
| { | ||
| text: "Guida a Webex", | ||
| }, | ||
| { | ||
| text: "Guida alla connessione alla rete del Polimi", | ||
| }, | ||
| ], | ||
| } | ||
|
|
||
| const guidesInfoMobile: CardResourceProps[] = [ | ||
| { | ||
| title: "Chimica Generale", | ||
| description: "È un esame che tratta tutti argomenti già visti in qualsiasi liceo scientifico...", | ||
| tag: { | ||
| text: "Teorico", | ||
| variant: "primary", | ||
| }, | ||
| author: "Giulia M.", | ||
| date: "Ott 24", | ||
| href: "/guides", | ||
| }, | ||
| { | ||
| title: "Chimica", | ||
| description: "È un esame che tratta tutti argomenti già visti in qualsiasi liceo scientifico...", | ||
| tag: [ | ||
| { | ||
| text: "Teorico", | ||
| variant: "primary", | ||
| }, | ||
| { | ||
| text: "2 Anno", | ||
| variant: "secondary", | ||
| }, | ||
| ], | ||
| author: "Giulia M.", | ||
| date: "Ott 24", | ||
| href: "/guides", | ||
| }, | ||
| { | ||
| title: "Generale", | ||
| description: "È un esame che tratta tutti argomenti già visti in qualsiasi liceo scientifico...", | ||
| tag: { | ||
| text: "Teorico", | ||
| variant: "primary", | ||
| }, | ||
| author: "Giulia M.", | ||
| date: "Ott 24", | ||
| href: "/guides", | ||
| }, | ||
| ] | ||
|
|
||
| const guidesMobile = { | ||
| title: "Trova le guide del tuo corso", | ||
| caption: "Una raccolta di guide scritte dagli studenti del tuo corso", | ||
| icon: FiLogIn, | ||
| } | ||
|
|
||
| export default function GuidePage() { | ||
| return ( | ||
| <section className="flex min-h-screen w-full max-w-350 flex-col gap-32 px-12 pt-58 pb-18 sm:gap-48"> | ||
| <Hero title="Guide" description="Una raccolta di guide realizzate dai membri del Network" /> | ||
|
|
||
| {/* Desktop */} | ||
| <div className="hidden w-full flex-col gap-28 sm:flex"> | ||
| <GuideContent {...guidesInfo} /> | ||
|
|
||
| <GuideContent {...guidesGeneral} /> | ||
| </div> | ||
|
|
||
| {/* Mobile */} | ||
| <div className="flex w-full flex-col items-center gap-32 sm:hidden"> | ||
| <CardCaption {...guidesMobile} className="p-6" /> | ||
|
|
||
| <GuideContentMobile title="Guide Generali" guides={guidesInfoMobile} /> | ||
| </div> | ||
| </section> | ||
| ) | ||
| } | ||
This file contains hidden or 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,59 @@ | ||
| "use client" | ||
|
|
||
| import Link from "next/link" | ||
| import { useState } from "react" | ||
| import { FiBookmark } from "react-icons/fi" | ||
| import { Card, CardContent, CardTitle } from "@/components/ui/card" | ||
| import { Pill } from "@/components/ui/pill" | ||
| import { cn } from "@/lib/utils" | ||
| import type { CardResourceProps } from "./types" | ||
|
|
||
| export function CardResource({ | ||
| tag, | ||
| title, | ||
| description, | ||
| author, | ||
| date, | ||
| bookmarked: initialBookmarked = false, | ||
| href, | ||
| className, | ||
| }: CardResourceProps) { | ||
| const [bookmarked, setBookmarked] = useState(initialBookmarked) | ||
|
|
||
| return ( | ||
| <Card className={cn("h-fit w-full p-6", className)}> | ||
| <Link href={href} className="flex h-full flex-col"> | ||
| <div className="flex items-center justify-between"> | ||
| <div className="flex gap-2"> | ||
| {(Array.isArray(tag) ? tag : [tag]).map((t) => ( | ||
| <Pill key={t.text} variant={t.variant}> | ||
| {t.text} | ||
| </Pill> | ||
| ))} | ||
|
BIA3IA marked this conversation as resolved.
|
||
| </div> | ||
| <button | ||
| type="button" | ||
| aria-label={bookmarked ? "Remove bookmark" : "Add bookmark"} | ||
| onClick={(e) => { | ||
| e.preventDefault() | ||
| setBookmarked((b) => !b) | ||
| }} | ||
| className={cn(bookmarked ? "text-text-secondary" : "text-text-secondary hover:text-text-primary")} | ||
| > | ||
| <FiBookmark className={cn("h-5 w-5", bookmarked && "fill-current")} /> | ||
| </button> | ||
|
BIA3IA marked this conversation as resolved.
|
||
| </div> | ||
|
|
||
| <div className="mt-5 flex flex-1 flex-col gap-2"> | ||
| <CardTitle className="typo-title-large">{title}</CardTitle> | ||
| <CardContent className="typo-body-large line-clamp-3 px-0 text-text-primary">{description}</CardContent> | ||
| </div> | ||
|
|
||
| <div className="typo-body-large mt-12 flex items-center justify-between text-text-secondary"> | ||
| <span>{author}</span> | ||
| <span>{date}</span> | ||
| </div> | ||
| </Link> | ||
| </Card> | ||
| ) | ||
| } | ||
This file contains hidden or 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,17 @@ | ||
| import type { PillVariant } from "@/components/ui/pill" | ||
|
|
||
| export type PillTag = { | ||
| text: string | ||
| variant: PillVariant | ||
| } | ||
|
|
||
| export type CardResourceProps = { | ||
| tag: PillTag | PillTag[] | ||
| title: string | ||
| description: string | ||
| author: string | ||
| date: string | ||
| bookmarked?: boolean | ||
| href: string | ||
| className?: string | ||
| } |
This file contains hidden or 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,11 @@ | ||
| import { Card, CardContent } from "./ui/card" | ||
|
|
||
| export default function CardText({ text, className }: { text: string; className?: string }) { | ||
| return ( | ||
| <Card className={`h-fit w-full rounded-3xl border-white/50 p-4 ${className || ""}`}> | ||
| <CardContent className="typo-headline-small bg-linear-to-b from-blue-secondary to-blue-primary bg-clip-text px-0 text-center font-normal text-transparent"> | ||
| {text} | ||
| </CardContent> | ||
| </Card> | ||
| ) | ||
| } |
This file contains hidden or 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,14 @@ | ||
| import { cn } from "@/lib/utils" | ||
| import { CardResource } from "../card-resource" | ||
| import type { GuideContentMobileProps } from "./types" | ||
|
|
||
| export function GuideContentMobile({ title, guides, className }: GuideContentMobileProps) { | ||
| return ( | ||
| <div className={cn("flex w-full flex-col gap-5 text-start", className)}> | ||
| <p className="typo-title-large">{title}</p> | ||
| {guides.map((guide) => ( | ||
| <CardResource key={guide.title} {...guide} /> | ||
| ))} | ||
|
BIA3IA marked this conversation as resolved.
|
||
| </div> | ||
| ) | ||
| } | ||
This file contains hidden or 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,19 @@ | ||
| import CardText from "@/components/card-text" | ||
| import { cn } from "@/lib/utils" | ||
| import type { GuideContentProps } from "./types" | ||
|
|
||
| export default function GuideContent({ title, description, guides, className }: GuideContentProps) { | ||
| return ( | ||
| <section className={cn("mx-auto flex w-full max-w-350 flex-col gap-14", className)}> | ||
| <div className="flex flex-col gap-2 text-start"> | ||
| <h3 className="typo-headline-small sm:typo-display-medium w-fit">{title}</h3> | ||
| <p className="typo-body-large text-text-primary">{description}</p> | ||
| </div> | ||
| <div className="mx-auto flex w-full max-w-5xl flex-col gap-4"> | ||
| {guides.map((guide) => ( | ||
| <CardText key={guide.text} text={guide.text} /> | ||
| ))} | ||
|
BIA3IA marked this conversation as resolved.
|
||
| </div> | ||
| </section> | ||
| ) | ||
| } | ||
This file contains hidden or 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,14 @@ | ||
| import type { CardResourceProps } from "../card-resource/types" | ||
|
|
||
| export type GuideContentProps = { | ||
| title: string | ||
| description: string | ||
| guides: { text: string }[] | ||
| className?: string | ||
| } | ||
|
|
||
| export type GuideContentMobileProps = { | ||
| title: string | ||
| guides: CardResourceProps[] | ||
| className?: string | ||
| } |
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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,10 @@ | ||
| export function Hero({ title, description }: { title: string; description: string }) { | ||
| return ( | ||
| <div className="flex flex-col items-center gap-6"> | ||
| <h2 className="typo-display-large sm:typo-display-extralarge w-fit bg-linear-to-b from-text-primary to-text-secondary bg-clip-text py-4 text-transparent sm:py-14"> | ||
| {title} | ||
| </h2> | ||
| <p className="typo-title-large sm:typo-headline-small max-w-2xl text-center">{description}</p> | ||
| </div> | ||
| ) | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.