Skip to content

Commit 4d64f33

Browse files
committed
Merge branch 'development' into feature/error-handling
2 parents 82e5ace + d917bde commit 4d64f33

File tree

10 files changed

+114
-49
lines changed

10 files changed

+114
-49
lines changed

src/components/controls/Button.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ import { twMerge } from "tailwind-merge";
44

55
import { RequiredKeys } from "@/types/utility";
66

7-
export const style = cva("flex items-center justify-center transition-colors shadow-sm px-3 py-2 gap-2 rounded-md", {
7+
export const style = cva("flex items-center justify-center transition-colors shadow-sm px-3 py-2 gap-2 rounded-full", {
88
variants: {
99
color: {
10-
secondary: "bg-secondary hover:bg-secondary-dark text-secondary-contrast"
10+
secondary: "bg-secondary hover:bg-secondary-light text-secondary-contrast"
1111
}
1212
}
1313
});

src/components/controls/Input.tsx

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import { ForwardedRef, forwardRef, InputHTMLAttributes, useMemo } from "react";
2+
import { cva, VariantProps as GetVariantProps } from "class-variance-authority";
3+
import { twMerge } from "tailwind-merge";
4+
5+
import { RequiredKeys } from "@/types/utility";
6+
7+
export const style = cva("rounded-full py-2 px-3", {
8+
variants: {
9+
variant: {
10+
outlined: "border-2"
11+
},
12+
color: {
13+
primary: ""
14+
},
15+
},
16+
compoundVariants: [
17+
{
18+
className: "border-primary bg-white",
19+
color: "primary",
20+
variant: "outlined"
21+
}
22+
],
23+
defaultVariants: {
24+
color: "primary",
25+
variant: "outlined"
26+
}
27+
});
28+
29+
export type TagProps = Omit<InputHTMLAttributes<HTMLInputElement>, "color">;
30+
export type VariantProps = GetVariantProps<typeof style>;
31+
export type InputProps = TagProps & RequiredKeys<VariantProps, "color" | "variant">;
32+
33+
const Input = forwardRef((
34+
{
35+
className,
36+
color,
37+
variant,
38+
...props
39+
}: InputProps,
40+
ref: ForwardedRef<HTMLInputElement>
41+
) => {
42+
43+
const computedClassName = useMemo(
44+
() => twMerge(style({ color, variant }), className),
45+
[className, color, variant]
46+
);
47+
48+
return (
49+
<input
50+
ref={ref}
51+
className={computedClassName}
52+
{...props}
53+
/>
54+
);
55+
});
56+
57+
export default Input;
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import { DetailedHTMLProps, ForwardedRef, forwardRef, TextareaHTMLAttributes, useMemo } from "react";
2+
import { twMerge } from "tailwind-merge";
3+
4+
import { RequiredKeys } from "@/types/utility";
5+
6+
import { style, VariantProps as InputVariantProps } from "./Input";
7+
8+
export type TagProps = DetailedHTMLProps<TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>;
9+
export type VariantProps = InputVariantProps;
10+
export type TextAreaProps = TagProps & RequiredKeys<VariantProps, "color" | "variant">;
11+
12+
const TextArea = forwardRef((
13+
{
14+
className,
15+
color,
16+
variant,
17+
...props
18+
}: TextAreaProps,
19+
ref: ForwardedRef<HTMLTextAreaElement>
20+
) => {
21+
22+
const computedClassName = useMemo(
23+
() => twMerge(style({ color, variant }), className),
24+
[className, color, variant]
25+
);
26+
27+
return (
28+
<textarea
29+
ref={ref}
30+
className={computedClassName}
31+
{...props}
32+
/>
33+
);
34+
});
35+
36+
export default TextArea;

src/components/navigation/Link.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ const Link = ({ className, color, underline, children, external, hrefLang = "en"
4444
<InternalLink
4545
className={computedClassName}
4646
hrefLang={hrefLang}
47-
rel={`${external ? "external" : ""} ${rel}`}
47+
rel={`${external ? "external" : ""} ${rel ?? ""}`}
4848
target={external ? "_blank" : undefined}
4949
{...props}
5050
>

src/components/navigation/NavLink.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const NavLink = ({ href, currentHref, children }: NavLinkProps) => {
1111
const active = currentHref === href;
1212
return (
1313
<Link
14-
className="text-lg font-bold py-2 border-y border-primary hover:border-primary-light aria-[current='page']:text-primary-dark aria-[current='page']:border-primary first-of-type:border-t-2 last-of-type:border-b-2 md:border-0 md:first-of-type:border-t-0 md:last-of-type:border-b-0"
14+
className="text-lg font-bold py-2 border-y border-primary hover:border-primary-dark aria-[current='page']:text-primary-light aria-[current='page']:border-primary first-of-type:border-t-2 last-of-type:border-b-2 md:border-0 md:first-of-type:border-t-0 md:last-of-type:border-b-0"
1515
aria-current={active ? "page" : undefined}
1616
color="primary"
1717
href={href}

src/components/pages/about/Member.tsx

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,8 @@ import { motion } from "framer-motion";
33
import { IMember } from "@/assets/state/team";
44
import LinkButton from "@/components/controls/LinkButton";
55

6-
const memberAnim = {
7-
hidden: {
8-
translateY: "5%",
9-
transition: {
10-
duration: 0.15,
11-
ease: "easeOut"
12-
}
13-
},
14-
show: {
15-
translateY: "0%",
16-
transition: {
17-
duration: 0.15,
18-
ease: "easeOut"
19-
}
20-
}
21-
} as const;
22-
236
const Member = ({ image, name, title, text, links, animate }: IMember & { animate: boolean; }) => (
24-
<motion.div
25-
variants={animate ? memberAnim : {}}
7+
<li
268
className="flex flex-col items-center w-full max-w-full gap-2 p-4 rounded-md shadow motion-safe:transition-all sm:p-6 md:w-fit shadow-primary"
279
aria-label="Member"
2810
>
@@ -52,7 +34,7 @@ const Member = ({ image, name, title, text, links, animate }: IMember & { animat
5234
</LinkButton>
5335
))}
5436
</div>
55-
</motion.div>
37+
</li>
5638
);
5739

5840
export default Member;

src/components/pages/front/FeedbackSection.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import Button from "@/components/controls/Button";
1212
import Error from "@/components/controls/Error";
1313
import Link from "@/components/navigation/Link";
1414
import { backend } from "@/utils/wretch";
15+
import TextArea from "@/components/controls/TextArea";
1516

1617
const feedbackSchema = z.object({
1718
text: z.string()
@@ -80,11 +81,12 @@ const FeedbackSection = () => {
8081
<form aria-label="feedback-inbox" className="flex flex-col items-center gap-4" onSubmit={submit}>
8182
<AnimatePresence mode="wait">
8283
{(!response || response.success === false) && <motion.div className="flex flex-col items-center w-full gap-4">
83-
<textarea
84-
className="w-full p-4 text-lg bg-white border-2 rounded-md md:text-xl border-primary h-fit"
84+
<TextArea
85+
86+
className="w-full p-4 text-lg rounded-lg md:text-xl h-fit"
8587
placeholder="I would like this feature!"
86-
{...register("text")}
8788
rows={5}
89+
{...register("text")}
8890
/>
8991
<Error className="w-full px-2 text-start" state={formState} name="text" />
9092
<Button type="submit" color="secondary" className="px-5 py-3 text-lg md:text-xl w-fit">

src/components/pages/front/SignupSection.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import Button from "@/components/controls/Button";
1313
import Error from "@/components/controls/Error";
1414
import Link from "@/components/navigation/Link";
1515
import { backend } from "@/utils/wretch";
16+
import Input from "@/components/controls/Input";
1617

1718

1819
const signupSchema = z.object({
@@ -105,8 +106,8 @@ const SignupSection = () => {
105106
exit="exit"
106107
>
107108
<div className="w-full">
108-
<input
109-
className="w-full p-4 text-lg bg-white border-2 rounded-md md:text-xl border-primary"
109+
<Input
110+
className="w-full p-4 text-lg md:text-xl"
110111
placeholder="your@email.com"
111112
{...register("email")}
112113
/>

src/pages/about.tsx

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,9 @@
11
import Head from "next/head";
2-
import { motion } from "framer-motion";
32

43
import members from "@/assets/state/team";
54
import Member from "@/components/pages/about/Member";
65
import { Page } from "@/types/page";
76

8-
const membersContainerAnim = {
9-
hidden: {},
10-
show: {
11-
transition: {
12-
staggerChildren: 0.1
13-
}
14-
}
15-
} as const;
16-
177
const AboutPage: Page = ({ initialLoad, reduceMotion }) => {
188
return (
199
<>
@@ -54,17 +44,14 @@ const AboutPage: Page = ({ initialLoad, reduceMotion }) => {
5444
>
5545
Team
5646
</h2>
57-
<motion.div
47+
<ul
5848
className="flex flex-wrap justify-center gap-4"
5949
aria-label="Members"
60-
initial="hidden"
61-
animate="show"
62-
variants={membersContainerAnim}
6350
>
6451
{members.map((member, i) => (
6552
<Member key={i} animate={!(reduceMotion || initialLoad)}{...member} />
6653
))}
67-
</motion.div>
54+
</ul>
6855
</section>
6956
</main>
7057
</>

src/pages/index.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ const FrontPage: Page = ({ }) => {
3131
<title>Commit Rocket</title>
3232
</Head>
3333
<main aria-labelledby="hero-title" className="flex flex-col flex-1 w-full gap-4 pb-8">
34-
<section aria-label="hero" className="flex flex-col-reverse items-center h-fit min-h-0 max-w-7xl lg:flex-row lg:min-h-[30rem] lg:h-[75dvh] lg:h-[75vh] mx-auto">
35-
<div className="relative flex flex-col items-center justify-center h-full col-span-3 gap-8 text-center lg:w-3/5">
36-
<div className="absolute w-full h-full opacity-20 aspect-square bg-gradient-radial from-primary to-transparent -z-10" aria-hidden />
34+
<section aria-label="hero" className="flex flex-col-reverse items-center h-fit min-h-0 max-w-7xl xl:flex-row xl:min-h-[30rem] xl:h-[75dvh] xl:h-[75vh] mx-auto">
35+
<div className="relative flex flex-col items-center justify-center h-full col-span-3 gap-8 text-center xl:w-3/5">
36+
{/* <div className="absolute w-full h-full opacity-20 aspect-square bg-gradient-radial from-primary to-transparent -z-10" aria-hidden /> */}
3737
<h1
3838
id="hero-title"
3939
className="text-3xl font-bold lg:text-6xl text-primary"
@@ -47,8 +47,8 @@ const FrontPage: Page = ({ }) => {
4747
Try it Yourself
4848
</LinkButton>
4949
</div>
50-
<div className="relative flex items-center justify-center w-full min-h-[20rem] max-h-[40dvh] max-h-[40vh] lg:min-h-0 lg:h-full lg:max-h-full lg:w-2/5" style={{ aspectRatio: `${LogoPicture.width} / ${LogoPicture.height}` }}>
51-
<div className="absolute w-full h-full opacity-50 aspect-square bg-gradient-radial from-primary to-transparent" aria-hidden />
50+
<div className="relative overflow-hidden flex items-center justify-center w-full min-h-[20rem] max-h-[40dvh] max-h-[40vh] xl:min-h-0 xl:h-full xl:max-h-full xl:w-2/5" style={{ aspectRatio: `${LogoPicture.width} / ${LogoPicture.height}` }}>
51+
{/* <div className="absolute w-full h-full opacity-20 aspect-square bg-gradient-radial from-primary to-transparent" aria-hidden /> */}
5252
<motion.img
5353
className="absolute max-w-full max-h-full object-contain aspect-auto w-full rotate-[10deg] text-[0px]"
5454
loading="eager"

0 commit comments

Comments
 (0)