Skip to content

Commit 2c4c9b1

Browse files
committed
feat: using neobrutalism style for the component
1 parent 43d632f commit 2c4c9b1

File tree

8 files changed

+166
-202
lines changed

8 files changed

+166
-202
lines changed

src/app/globals.css

+34-59
Original file line numberDiff line numberDiff line change
@@ -6,67 +6,42 @@ body {
66
font-family: Arial, Helvetica, sans-serif;
77
}
88

9-
@layer base {
9+
1010
:root {
11-
--background: 0 0% 100%;
12-
--foreground: 240 10% 3.9%;
13-
--card: 0 0% 100%;
14-
--card-foreground: 240 10% 3.9%;
15-
--popover: 0 0% 100%;
16-
--popover-foreground: 240 10% 3.9%;
17-
--primary: 240 5.9% 10%;
18-
--primary-foreground: 0 0% 98%;
19-
--secondary: 240 4.8% 95.9%;
20-
--secondary-foreground: 240 5.9% 10%;
21-
--muted: 240 4.8% 95.9%;
22-
--muted-foreground: 240 3.8% 46.1%;
23-
--accent: 240 4.8% 95.9%;
24-
--accent-foreground: 240 5.9% 10%;
25-
--destructive: 0 84.2% 60.2%;
26-
--destructive-foreground: 0 0% 98%;
27-
--border: 240 5.9% 90%;
28-
--input: 240 5.9% 90%;
29-
--ring: 240 10% 3.9%;
30-
--chart-1: 12 76% 61%;
31-
--chart-2: 173 58% 39%;
32-
--chart-3: 197 37% 24%;
33-
--chart-4: 43 74% 66%;
34-
--chart-5: 27 87% 67%;
35-
--radius: 0.5rem;
11+
--main: #88aaee;
12+
--overlay: rgba(0, 0, 0, 0.8); /* background color overlay for alert dialogs, modals, etc. */
13+
14+
--bg: #dfe5f2;
15+
--bw: #fff; /* white and secondary black e.g. utility class variant would be: bg-[#fff] dark:bg-[#212121] */
16+
--blank: #000; /* blank black and white */
17+
--border: #000;
18+
--text: #000;
19+
--mtext: #000; /* text that is placed on background with main color e.g. text color of default button */
20+
--ring: #000;
21+
--ring-offset: #fff;
22+
23+
--border-radius: 5px;
24+
--box-shadow-x: 4px;
25+
--box-shadow-y: 4px;
26+
--reverse-box-shadow-x: -4px;
27+
--reverse-box-shadow-y: -4px;
28+
--base-font-weight: 500;
29+
--heading-font-weight: 700;
30+
31+
--shadow: var(--box-shadow-x) var(--box-shadow-y) 0px 0px var(--border);
3632
}
33+
3734
.dark {
38-
--background: 240 10% 3.9%;
39-
--foreground: 0 0% 98%;
40-
--card: 240 10% 3.9%;
41-
--card-foreground: 0 0% 98%;
42-
--popover: 240 10% 3.9%;
43-
--popover-foreground: 0 0% 98%;
44-
--primary: 0 0% 98%;
45-
--primary-foreground: 240 5.9% 10%;
46-
--secondary: 240 3.7% 15.9%;
47-
--secondary-foreground: 0 0% 98%;
48-
--muted: 240 3.7% 15.9%;
49-
--muted-foreground: 240 5% 64.9%;
50-
--accent: 240 3.7% 15.9%;
51-
--accent-foreground: 0 0% 98%;
52-
--destructive: 0 62.8% 30.6%;
53-
--destructive-foreground: 0 0% 98%;
54-
--border: 240 3.7% 15.9%;
55-
--input: 240 3.7% 15.9%;
56-
--ring: 240 4.9% 83.9%;
57-
--chart-1: 220 70% 50%;
58-
--chart-2: 160 60% 45%;
59-
--chart-3: 30 80% 55%;
60-
--chart-4: 280 65% 60%;
61-
--chart-5: 340 75% 55%;
35+
--bg: #272933;
36+
--bw: #212121;
37+
--blank: #fff;
38+
--border: #000;
39+
--text: #e6e6e6;
40+
--mtext: #000;
41+
--ring: #fff;
42+
--ring-offset: #000;
43+
44+
--shadow: var(--box-shadow-x) var(--box-shadow-y) 0px 0px var(--border);
6245
}
63-
}
6446

65-
@layer base {
66-
* {
67-
@apply border-border;
68-
}
69-
body {
70-
@apply bg-background text-foreground;
71-
}
72-
}
47+

src/components/keluh-card.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export function KeluhCard({ post, onUpdate }: KeluhCardProps) {
5353
return (
5454
<>
5555
<Card
56-
className="h-[160px] p-5 bg-white dark:bg-gray-800 hover:shadow-lg transition-shadow cursor-pointer"
56+
className="h-40 p-5 bg-bg cursor-pointer hover:translate-x-boxShadowX hover:translate-y-boxShadowY hover:shadow-none transition-all"
5757
onClick={() => setIsOpen(true)}
5858
>
5959
<div className="flex justify-between items-start mb-2">

src/components/ui/button.tsx

+25-25
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,36 @@
1-
import * as React from "react"
2-
import { Slot } from "@radix-ui/react-slot"
3-
import { cva, type VariantProps } from "class-variance-authority"
1+
import { Slot } from '@radix-ui/react-slot'
2+
import { cva, type VariantProps } from 'class-variance-authority'
43

5-
import { cn } from "@/lib/utils"
4+
import * as React from 'react'
5+
6+
import { cn } from '@/lib/utils'
67

78
const buttonVariants = cva(
8-
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
9+
'inline-flex items-center justify-center whitespace-nowrap rounded-base text-sm font-base ring-offset-white transition-all gap-2 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-black focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50',
910
{
1011
variants: {
1112
variant: {
12-
default: "bg-primary text-primary-foreground hover:bg-primary/90",
13-
destructive:
14-
"bg-destructive text-destructive-foreground hover:bg-destructive/90",
15-
outline:
16-
"border border-input bg-background hover:bg-accent hover:text-accent-foreground",
17-
secondary:
18-
"bg-secondary text-secondary-foreground hover:bg-secondary/80",
19-
ghost: "hover:bg-accent hover:text-accent-foreground",
20-
link: "text-primary underline-offset-4 hover:underline",
13+
default:
14+
'text-mtext bg-main border-2 border-border shadow-shadow hover:translate-x-boxShadowX hover:translate-y-boxShadowY hover:shadow-none',
15+
noShadow:
16+
'text-mtext bg-main border-2 border-border',
17+
neutral:
18+
'bg-bw text-text border-2 border-border shadow-shadow hover:translate-x-boxShadowX hover:translate-y-boxShadowY hover:shadow-none',
19+
reverse:
20+
'text-mtext bg-main border-2 border-border hover:translate-x-reverseBoxShadowX hover:translate-y-reverseBoxShadowY hover:shadow-shadow',
2121
},
2222
size: {
23-
default: "h-10 px-4 py-2",
24-
sm: "h-9 rounded-md px-3",
25-
lg: "h-11 rounded-md px-8",
26-
icon: "h-10 w-10",
23+
default: 'h-10 px-4 py-2',
24+
sm: 'h-9 px-3',
25+
lg: 'h-11 px-8',
26+
icon: 'h-10 w-10',
2727
},
2828
},
2929
defaultVariants: {
30-
variant: "default",
31-
size: "default",
30+
variant: 'default',
31+
size: 'default',
3232
},
33-
}
33+
},
3434
)
3535

3636
export interface ButtonProps
@@ -41,16 +41,16 @@ export interface ButtonProps
4141

4242
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
4343
({ className, variant, size, asChild = false, ...props }, ref) => {
44-
const Comp = asChild ? Slot : "button"
44+
const Comp = asChild ? Slot : 'button'
4545
return (
4646
<Comp
4747
className={cn(buttonVariants({ variant, size, className }))}
4848
ref={ref}
4949
{...props}
5050
/>
5151
)
52-
}
52+
},
5353
)
54-
Button.displayName = "Button"
54+
Button.displayName = 'Button'
5555

56-
export { Button, buttonVariants }
56+
export { Button, buttonVariants }

src/components/ui/card.tsx

+21-21
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import * as React from "react"
1+
import * as React from 'react'
22

3-
import { cn } from "@/lib/utils"
3+
import { cn } from '@/lib/utils'
44

55
const Card = React.forwardRef<
66
HTMLDivElement,
@@ -9,71 +9,71 @@ const Card = React.forwardRef<
99
<div
1010
ref={ref}
1111
className={cn(
12-
"rounded-lg border bg-card text-card-foreground shadow-sm",
13-
className
12+
'rounded-base shadow-shadow border-2 border-border bg-main text-mtext',
13+
className,
1414
)}
1515
{...props}
1616
/>
1717
))
18-
Card.displayName = "Card"
18+
Card.displayName = 'Card'
1919

2020
const CardHeader = React.forwardRef<
2121
HTMLDivElement,
2222
React.HTMLAttributes<HTMLDivElement>
2323
>(({ className, ...props }, ref) => (
2424
<div
2525
ref={ref}
26-
className={cn("flex flex-col space-y-1.5 p-6", className)}
26+
className={cn('flex flex-col space-y-1.5 p-6', className)}
2727
{...props}
2828
/>
2929
))
30-
CardHeader.displayName = "CardHeader"
30+
CardHeader.displayName = 'CardHeader'
3131

3232
const CardTitle = React.forwardRef<
33-
HTMLDivElement,
34-
React.HTMLAttributes<HTMLDivElement>
33+
HTMLParagraphElement,
34+
React.HTMLAttributes<HTMLHeadingElement>
3535
>(({ className, ...props }, ref) => (
3636
<div
3737
ref={ref}
3838
className={cn(
39-
"text-2xl font-semibold leading-none tracking-tight",
40-
className
39+
'text-xl leading-none font-heading tracking-tight',
40+
className,
4141
)}
4242
{...props}
4343
/>
4444
))
45-
CardTitle.displayName = "CardTitle"
45+
CardTitle.displayName = 'CardTitle'
4646

4747
const CardDescription = React.forwardRef<
48-
HTMLDivElement,
49-
React.HTMLAttributes<HTMLDivElement>
48+
HTMLParagraphElement,
49+
React.HTMLAttributes<HTMLParagraphElement>
5050
>(({ className, ...props }, ref) => (
5151
<div
5252
ref={ref}
53-
className={cn("text-sm text-muted-foreground", className)}
53+
className={cn('text-sm text-mtext font-base !mt-3', className)}
5454
{...props}
5555
/>
5656
))
57-
CardDescription.displayName = "CardDescription"
57+
CardDescription.displayName = 'CardDescription'
5858

5959
const CardContent = React.forwardRef<
6060
HTMLDivElement,
6161
React.HTMLAttributes<HTMLDivElement>
6262
>(({ className, ...props }, ref) => (
63-
<div ref={ref} className={cn("p-6 pt-0", className)} {...props} />
63+
<div ref={ref} className={cn('p-6 pt-0', className)} {...props} />
6464
))
65-
CardContent.displayName = "CardContent"
65+
CardContent.displayName = 'CardContent'
6666

6767
const CardFooter = React.forwardRef<
6868
HTMLDivElement,
6969
React.HTMLAttributes<HTMLDivElement>
7070
>(({ className, ...props }, ref) => (
7171
<div
7272
ref={ref}
73-
className={cn("flex items-center p-6 pt-0", className)}
73+
className={cn('flex items-center p-6 pt-0', className)}
7474
{...props}
7575
/>
7676
))
77-
CardFooter.displayName = "CardFooter"
77+
CardFooter.displayName = 'CardFooter'
7878

79-
export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent }
79+
export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent }

src/components/ui/dialog.tsx

+21-20
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
"use client"
1+
'use client'
22

3-
import * as React from "react"
4-
import * as DialogPrimitive from "@radix-ui/react-dialog"
5-
import { X } from "lucide-react"
3+
import * as DialogPrimitive from '@radix-ui/react-dialog'
4+
import { X } from 'lucide-react'
65

7-
import { cn } from "@/lib/utils"
6+
import * as React from 'react'
7+
8+
import { cn } from '@/lib/utils'
89

910
const Dialog = DialogPrimitive.Root
1011

@@ -21,8 +22,8 @@ const DialogOverlay = React.forwardRef<
2122
<DialogPrimitive.Overlay
2223
ref={ref}
2324
className={cn(
24-
"fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
25-
className
25+
'fixed inset-0 z-50 bg-overlay data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0',
26+
className,
2627
)}
2728
{...props}
2829
/>
@@ -38,13 +39,13 @@ const DialogContent = React.forwardRef<
3839
<DialogPrimitive.Content
3940
ref={ref}
4041
className={cn(
41-
"fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 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-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
42-
className
42+
'fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 rounded-base border-2 border-border bg-bg p-6 shadow-shadow duration-200 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-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]',
43+
className,
4344
)}
4445
{...props}
4546
>
4647
{children}
47-
<DialogPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground">
48+
<DialogPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-100 ring-offset-white focus:outline-none focus:ring-2 focus:ring-black focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-white data-[state=open]:text-white">
4849
<X className="h-4 w-4" />
4950
<span className="sr-only">Close</span>
5051
</DialogPrimitive.Close>
@@ -59,27 +60,27 @@ const DialogHeader = ({
5960
}: React.HTMLAttributes<HTMLDivElement>) => (
6061
<div
6162
className={cn(
62-
"flex flex-col space-y-1.5 text-center sm:text-left",
63-
className
63+
'flex flex-col space-y-1.5 text-center sm:text-left',
64+
className,
6465
)}
6566
{...props}
6667
/>
6768
)
68-
DialogHeader.displayName = "DialogHeader"
69+
DialogHeader.displayName = 'DialogHeader'
6970

7071
const DialogFooter = ({
7172
className,
7273
...props
7374
}: React.HTMLAttributes<HTMLDivElement>) => (
7475
<div
7576
className={cn(
76-
"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
77-
className
77+
'flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2',
78+
className,
7879
)}
7980
{...props}
8081
/>
8182
)
82-
DialogFooter.displayName = "DialogFooter"
83+
DialogFooter.displayName = 'DialogFooter'
8384

8485
const DialogTitle = React.forwardRef<
8586
React.ElementRef<typeof DialogPrimitive.Title>,
@@ -88,8 +89,8 @@ const DialogTitle = React.forwardRef<
8889
<DialogPrimitive.Title
8990
ref={ref}
9091
className={cn(
91-
"text-lg font-semibold leading-none tracking-tight",
92-
className
92+
'text-lg font-heading leading-none tracking-tight',
93+
className,
9394
)}
9495
{...props}
9596
/>
@@ -102,7 +103,7 @@ const DialogDescription = React.forwardRef<
102103
>(({ className, ...props }, ref) => (
103104
<DialogPrimitive.Description
104105
ref={ref}
105-
className={cn("text-sm text-muted-foreground", className)}
106+
className={cn('text-sm font-base text-text', className)}
106107
{...props}
107108
/>
108109
))
@@ -119,4 +120,4 @@ export {
119120
DialogFooter,
120121
DialogTitle,
121122
DialogDescription,
122-
}
123+
}

0 commit comments

Comments
 (0)