Commit 6fc2a475 authored by Wellton Quirino's avatar Wellton Quirino

carousel in course home page and create filters in student page

parent 2e987083
This diff is collapsed.
import { BannerCategory } from '@/components/banner-category' import { BannerCategory } from '@/components/banner-category'
import { NavLinkCategory } from '@/components/nav-link-category' import { NavLinkCategory } from '@/components/nav-link-category'
import SearchFilter from '@/components/search-filter'
export default function Students() { export default function Students() {
return ( return (
<main> <main>
<BannerCategory /> <BannerCategory title="Estudante" />
<NavLinkCategory /> <NavLinkCategory />
<SearchFilter />
</main> </main>
) )
} }
export function BannerCategory() { type BannerProps = {
title: string
}
export function BannerCategory({ title }: BannerProps) {
return ( return (
<div className=" h-[300px] flex items-center justify-end bg-green-900"> <div className=" h-[300px] flex items-center justify-end bg-green-900">
<div className="container"> <div className="container">
<h1>ESTUDANTE</h1> <h1>{title}</h1>
</div> </div>
</div> </div>
) )
......
...@@ -8,9 +8,9 @@ import Link from 'next/link' ...@@ -8,9 +8,9 @@ import Link from 'next/link'
export function CourseCategory() { export function CourseCategory() {
return ( return (
<section className="hidden md:block"> <section className="hidden md:block">
<div className="container h-auto flex justify-center items-center my-20"> <div className="h-auto flex justify-center items-center my-20 px-6">
<ul className="flex justify-center items-center gap-4"> <ul className="flex justify-center items-center gap-4">
<li className="max-w-[420px] bg-green-600 rounded-lg pb-4"> <li className="max-w-[472px] bg-green-600 rounded-lg pb-4">
<Link href="#" className="flex flex-col gap-4"> <Link href="#" className="flex flex-col gap-4">
<Image <Image
src={ImageFast} src={ImageFast}
...@@ -25,7 +25,7 @@ export function CourseCategory() { ...@@ -25,7 +25,7 @@ export function CourseCategory() {
</p> </p>
</Link> </Link>
</li> </li>
<li className="max-w-[420px] bg-green-600 rounded-lg pb-4"> <li className="max-w-[472px] bg-green-600 rounded-lg pb-4">
<Link href="#" className="flex flex-col gap-4"> <Link href="#" className="flex flex-col gap-4">
<Image <Image
src={ImageDeepen} src={ImageDeepen}
...@@ -40,7 +40,7 @@ export function CourseCategory() { ...@@ -40,7 +40,7 @@ export function CourseCategory() {
</p> </p>
</Link> </Link>
</li> </li>
<li className="max-w-[420px] bg-green-600 rounded-lg pb-4"> <li className="max-w-[472px] bg-green-600 rounded-lg pb-4">
<Link href="#" className="flex flex-col gap-4"> <Link href="#" className="flex flex-col gap-4">
<Image <Image
src={ImageCorporate} src={ImageCorporate}
......
This diff is collapsed.
import { Search } from 'lucide-react'
import { Input } from './ui/input'
import {
Select,
SelectContent,
SelectGroup,
SelectItem,
SelectTrigger,
SelectValue,
} from './ui/select'
import { Label } from './ui/label'
export default function SearchFilter() {
return (
<div className="container grid md:grid-cols-2 gap-8 items-end mb-8">
<div className="flex items-center max-w-[712px] flex-1">
<Input className="pr-8" />
<Search size={24} className="-ml-6" />
</div>
<div>
<Label>Filtrados por</Label>
<Select defaultValue="recent">
<SelectTrigger className="flex items-center max-w-[712px] flex-1">
<SelectValue />
</SelectTrigger>
<SelectContent>
<SelectGroup>
<SelectItem value="recent">Mais recentes</SelectItem>
<SelectItem value="fast">Cursos rápidos</SelectItem>
<SelectItem value="students">Estudantes</SelectItem>
<SelectItem value="immediate">Início imediato</SelectItem>
</SelectGroup>
</SelectContent>
</Select>
</div>
</div>
)
}
'use client'
import Image from 'next/image' import Image from 'next/image'
import signUpImage from '../../public/images/sign-up.png' import signUpImage from '../../public/images/sign-up.png'
...@@ -5,8 +7,21 @@ import { Input } from '@/components/ui/input' ...@@ -5,8 +7,21 @@ import { Input } from '@/components/ui/input'
import { Label } from '@/components/ui/label' import { Label } from '@/components/ui/label'
import { Button } from '@/components/ui/button' import { Button } from '@/components/ui/button'
import { Separator } from '@/components/ui/separator' import { Separator } from '@/components/ui/separator'
import { SubmitHandler, useForm } from 'react-hook-form'
type FormSignUpTypes = {
name: string
email: string
whatsapp: string
interest: string
course: string
}
export function SignUp() { export function SignUp() {
const { register, handleSubmit } = useForm<FormSignUpTypes>()
const onSubmit: SubmitHandler<FormSignUpTypes> = (data) => console.log(data)
return ( return (
<section className="w-full bg-gradient-to-r from-green-700 to-green-50 pb-6 md:py-6 md:pb-0"> <section className="w-full bg-gradient-to-r from-green-700 to-green-50 pb-6 md:py-6 md:pb-0">
<div className="container overflow-hidden relative h-auto flex flex-col md:flex-row gap-2 justify-between items-center "> <div className="container overflow-hidden relative h-auto flex flex-col md:flex-row gap-2 justify-between items-center ">
...@@ -22,40 +37,66 @@ export function SignUp() { ...@@ -22,40 +37,66 @@ export function SignUp() {
/> />
<Separator className="h-2 w-screen order-2 md:hidden -mt-3 bg-yellow-100" /> <Separator className="h-2 w-screen order-2 md:hidden -mt-3 bg-yellow-100" />
<form <form
action="" onSubmit={handleSubmit(onSubmit)}
className="w-full md:w-[600px] flex flex-col gap-8 order-4" className="w-full md:w-[600px] flex flex-col gap-8 order-4"
> >
<div> <div>
<Label htmlFor="name" className="text-gray-300 text-xs"> <Label htmlFor="name" className="text-gray-300 text-xs">
Nome Nome
</Label> </Label>
<Input type="text" id="name" placeholder="Digite aqui" /> <Input
type="text"
id="name"
placeholder="Digite aqui"
{...register('name')}
/>
</div> </div>
<div> <div>
<Label htmlFor="email" className="text-gray-300 text-xs"> <Label htmlFor="email" className="text-gray-300 text-xs">
E-mail E-mail
</Label> </Label>
<Input type="email" id="email" placeholder="Digite aqui" /> <Input
type="email"
id="email"
placeholder="Digite aqui"
{...register('email')}
/>
</div> </div>
<div> <div>
<Label htmlFor="whatsapp" className="text-gray-300 text-xs"> <Label htmlFor="whatsapp" className="text-gray-300 text-xs">
Whatsapp Whatsapp
</Label> </Label>
<Input type="number" id="whatsapp" placeholder="Digite aqui" /> <Input
type="number"
id="whatsapp"
placeholder="Digite aqui"
{...register('whatsapp')}
/>
</div> </div>
<div> <div>
<Label htmlFor="interest" className="text-gray-300 text-xs"> <Label htmlFor="interest" className="text-gray-300 text-xs">
Área de interesse Área de interesse
</Label> </Label>
<Input type="text" id="interest" placeholder="Digite aqui" /> <Input
type="text"
id="interest"
placeholder="Digite aqui"
{...register('interest')}
/>
</div> </div>
<div> <div>
<Label htmlFor="course" className="text-gray-300 text-xs"> <Label htmlFor="course" className="text-gray-300 text-xs">
Curso desejado Curso desejado
</Label> </Label>
<Input type="text" id="course" placeholder="Digite aqui" /> <Input
type="text"
id="course"
placeholder="Digite aqui"
{...register('course')}
/>
</div> </div>
<Button <Button
type="submit"
variant="secondary" variant="secondary"
className="uppercase max-w-32 mx-auto md:mb-6" className="uppercase max-w-32 mx-auto md:mb-6"
> >
......
'use client'
import * as React from 'react'
import useEmblaCarousel, {
type UseEmblaCarouselType,
} from 'embla-carousel-react'
import { ChevronLeft, ChevronRight } from 'lucide-react'
import { cn } from '@/lib/utils'
import { Button } from '@/components/ui/button'
type CarouselApi = UseEmblaCarouselType[1]
type UseCarouselParameters = Parameters<typeof useEmblaCarousel>
type CarouselOptions = UseCarouselParameters[0]
type CarouselPlugin = UseCarouselParameters[1]
type CarouselProps = {
opts?: CarouselOptions
plugins?: CarouselPlugin
orientation?: 'horizontal' | 'vertical'
setApi?: (api: CarouselApi) => void
}
type CarouselContextProps = {
carouselRef: ReturnType<typeof useEmblaCarousel>[0]
api: ReturnType<typeof useEmblaCarousel>[1]
scrollPrev: () => void
scrollNext: () => void
canScrollPrev: boolean
canScrollNext: boolean
} & CarouselProps
const CarouselContext = React.createContext<CarouselContextProps | null>(null)
function useCarousel() {
const context = React.useContext(CarouselContext)
if (!context) {
throw new Error('useCarousel must be used within a <Carousel />')
}
return context
}
const Carousel = React.forwardRef<
HTMLDivElement,
React.HTMLAttributes<HTMLDivElement> & CarouselProps
>(
(
{
orientation = 'horizontal',
opts,
setApi,
plugins,
className,
children,
...props
},
ref,
) => {
const [carouselRef, api] = useEmblaCarousel(
{
...opts,
axis: orientation === 'horizontal' ? 'x' : 'y',
},
plugins,
)
const [canScrollPrev, setCanScrollPrev] = React.useState(false)
const [canScrollNext, setCanScrollNext] = React.useState(false)
const onSelect = React.useCallback((api: CarouselApi) => {
if (!api) {
return
}
setCanScrollPrev(api.canScrollPrev())
setCanScrollNext(api.canScrollNext())
}, [])
const scrollPrev = React.useCallback(() => {
api?.scrollPrev()
}, [api])
const scrollNext = React.useCallback(() => {
api?.scrollNext()
}, [api])
const handleKeyDown = React.useCallback(
(event: React.KeyboardEvent<HTMLDivElement>) => {
if (event.key === 'ArrowLeft') {
event.preventDefault()
scrollPrev()
} else if (event.key === 'ArrowRight') {
event.preventDefault()
scrollNext()
}
},
[scrollPrev, scrollNext],
)
React.useEffect(() => {
if (!api || !setApi) {
return
}
setApi(api)
}, [api, setApi])
React.useEffect(() => {
if (!api) {
return
}
onSelect(api)
api.on('reInit', onSelect)
api.on('select', onSelect)
return () => {
api?.off('select', onSelect)
}
}, [api, onSelect])
return (
<CarouselContext.Provider
value={{
carouselRef,
api,
opts,
orientation:
orientation || (opts?.axis === 'y' ? 'vertical' : 'horizontal'),
scrollPrev,
scrollNext,
canScrollPrev,
canScrollNext,
}}
>
<div
ref={ref}
onKeyDownCapture={handleKeyDown}
className={cn('relative', className)}
role="region"
aria-roledescription="carousel"
{...props}
>
{children}
</div>
</CarouselContext.Provider>
)
},
)
Carousel.displayName = 'Carousel'
const CarouselContent = React.forwardRef<
HTMLDivElement,
React.HTMLAttributes<HTMLDivElement>
>(({ className, ...props }, ref) => {
const { carouselRef, orientation } = useCarousel()
return (
<div ref={carouselRef} className="overflow-hidden">
<div
ref={ref}
className={cn(
'flex',
orientation === 'horizontal' ? '-ml-4' : '-mt-4 flex-col',
className,
)}
{...props}
/>
</div>
)
})
CarouselContent.displayName = 'CarouselContent'
const CarouselItem = React.forwardRef<
HTMLDivElement,
React.HTMLAttributes<HTMLDivElement>
>(({ className, ...props }, ref) => {
const { orientation } = useCarousel()
return (
<div
ref={ref}
role="group"
aria-roledescription="slide"
className={cn(
'min-w-0 shrink-0 grow-0 basis-full',
orientation === 'horizontal' ? 'pl-4' : 'pt-4',
className,
)}
{...props}
/>
)
})
CarouselItem.displayName = 'CarouselItem'
const CarouselPrevious = React.forwardRef<
HTMLButtonElement,
React.ComponentProps<typeof Button>
>(({ className, variant = 'outline', size = 'icon', ...props }, ref) => {
const { orientation, scrollPrev, canScrollPrev } = useCarousel()
return (
<Button
ref={ref}
variant={variant}
size={size}
className={cn(
'absolute h-8 w-8 rounded-full border-none text-green-400',
orientation === 'horizontal'
? '-left-8 top-1/2 -translate-y-1/2'
: '-top-12 left-1/2 -translate-x-1/2 rotate-90',
className,
)}
disabled={!canScrollPrev}
onClick={scrollPrev}
{...props}
>
<ChevronLeft className="h-4 w-4" />
<span className="sr-only">Previous slide</span>
</Button>
)
})
CarouselPrevious.displayName = 'CarouselPrevious'
const CarouselNext = React.forwardRef<
HTMLButtonElement,
React.ComponentProps<typeof Button>
>(({ className, variant = 'outline', size = 'icon', ...props }, ref) => {
const { orientation, scrollNext, canScrollNext } = useCarousel()
return (
<Button
ref={ref}
variant={variant}
size={size}
className={cn(
'absolute h-8 w-8 rounded-full border-none text-green-400',
orientation === 'horizontal'
? '-right-8 top-1/2 -translate-y-1/2'
: '-bottom-12 left-1/2 -translate-x-1/2 rotate-90',
className,
)}
disabled={!canScrollNext}
onClick={scrollNext}
{...props}
>
<ChevronRight className="h-4 w-4" />
<span className="sr-only">Next slide</span>
</Button>
)
})
CarouselNext.displayName = 'CarouselNext'
export {
type CarouselApi,
Carousel,
CarouselContent,
CarouselItem,
CarouselPrevious,
CarouselNext,
}
...@@ -11,7 +11,7 @@ const Input = React.forwardRef<HTMLInputElement, InputProps>( ...@@ -11,7 +11,7 @@ const Input = React.forwardRef<HTMLInputElement, InputProps>(
<input <input
type={type} type={type}
className={cn( className={cn(
'flex h-10 w-full border border-t-0 border-x-0 border-gray-300 px-2 py-2 text-md text-white ile:border-0 bg-transparent file:bg-transparent file:text-sm file:font-medium placeholder:text-gray-300 focus-visible:outline-none focus-visible:border-b-white disabled:cursor-not-allowed disabled:opacity-50', 'flex h-10 w-full border border-t-0 border-x-0 border-gray-300 px-2 py-2 text-md text-white ile:border-0 bg-transparent file:bg-transparent file:text-sm file:font-medium placeholder:text-gray-300 focus-visible:outline-none focus-visible:border-b-white focus-visible:border-b-2 disabled:cursor-not-allowed disabled:opacity-50',
className, className,
)} )}
ref={ref} ref={ref}
......
'use client'
import * as React from 'react'
import * as SelectPrimitive from '@radix-ui/react-select'
import { Check, ChevronDown, ChevronUp } from 'lucide-react'
import { cn } from '@/lib/utils'
const Select = SelectPrimitive.Root
const SelectGroup = SelectPrimitive.Group
const SelectValue = SelectPrimitive.Value
const SelectTrigger = React.forwardRef<
React.ElementRef<typeof SelectPrimitive.Trigger>,
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>
>(({ className, children, ...props }, ref) => (
<SelectPrimitive.Trigger
ref={ref}
className={cn(
'flex h-10 w-full items-center justify-between border border-t-0 border-x-0 border-gray-300 px-2 py-2 text-md text-white ile:border-0 bg-transparent file:bg-transparent file:text-sm file:font-medium placeholder:text-gray-300 focus-visible:outline-none focus-visible:border-b-white focus-visible:border-b-2 disabled:cursor-not-allowed disabled:opacity-50',
className,
)}
{...props}
>
{children}
<SelectPrimitive.Icon asChild>
<ChevronDown className="h-4 w-4 opacity-50" />
</SelectPrimitive.Icon>
</SelectPrimitive.Trigger>
))
SelectTrigger.displayName = SelectPrimitive.Trigger.displayName
const SelectScrollUpButton = React.forwardRef<
React.ElementRef<typeof SelectPrimitive.ScrollUpButton>,
React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollUpButton>
>(({ className, ...props }, ref) => (
<SelectPrimitive.ScrollUpButton
ref={ref}
className={cn(
'flex cursor-default items-center justify-center py-1',
className,
)}
{...props}
>
<ChevronUp className="h-4 w-4" />
</SelectPrimitive.ScrollUpButton>
))
SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName
const SelectScrollDownButton = React.forwardRef<
React.ElementRef<typeof SelectPrimitive.ScrollDownButton>,
React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollDownButton>
>(({ className, ...props }, ref) => (
<SelectPrimitive.ScrollDownButton
ref={ref}
className={cn(
'flex cursor-default items-center justify-center py-1',
className,
)}
{...props}
>
<ChevronDown className="h-4 w-4" />
</SelectPrimitive.ScrollDownButton>
))
SelectScrollDownButton.displayName =
SelectPrimitive.ScrollDownButton.displayName
const SelectContent = React.forwardRef<
React.ElementRef<typeof SelectPrimitive.Content>,
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content>
>(({ className, children, position = 'popper', ...props }, ref) => (
<SelectPrimitive.Portal>
<SelectPrimitive.Content
ref={ref}
className={cn(
'relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2',
position === 'popper' &&
'data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1',
className,
)}
position={position}
{...props}
>
<SelectScrollUpButton />
<SelectPrimitive.Viewport
className={cn(
'p-1',
position === 'popper' &&
'h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]',
)}
>
{children}
</SelectPrimitive.Viewport>
<SelectScrollDownButton />
</SelectPrimitive.Content>
</SelectPrimitive.Portal>
))
SelectContent.displayName = SelectPrimitive.Content.displayName
const SelectLabel = React.forwardRef<
React.ElementRef<typeof SelectPrimitive.Label>,
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Label>
>(({ className, ...props }, ref) => (
<SelectPrimitive.Label
ref={ref}
className={cn('py-1.5 pl-8 pr-2 text-sm font-semibold', className)}
{...props}
/>
))
SelectLabel.displayName = SelectPrimitive.Label.displayName
const SelectItem = React.forwardRef<
React.ElementRef<typeof SelectPrimitive.Item>,
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item>
>(({ className, children, ...props }, ref) => (
<SelectPrimitive.Item
ref={ref}
className={cn(
'relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50',
className,
)}
{...props}
>
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
<SelectPrimitive.ItemIndicator>
<Check className="h-4 w-4" />
</SelectPrimitive.ItemIndicator>
</span>
<SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
</SelectPrimitive.Item>
))
SelectItem.displayName = SelectPrimitive.Item.displayName
const SelectSeparator = React.forwardRef<
React.ElementRef<typeof SelectPrimitive.Separator>,
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Separator>
>(({ className, ...props }, ref) => (
<SelectPrimitive.Separator
ref={ref}
className={cn('-mx-1 my-1 h-px bg-muted', className)}
{...props}
/>
))
SelectSeparator.displayName = SelectPrimitive.Separator.displayName
export {
Select,
SelectGroup,
SelectValue,
SelectTrigger,
SelectContent,
SelectLabel,
SelectItem,
SelectSeparator,
SelectScrollUpButton,
SelectScrollDownButton,
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment