Skip to content

Connect, collaborate, and grow with a community of TypeScript developers

Explore (#23)

PickleNik9625f367ae57
diff --git a/src/components/explore/explore-card.tsx b/src/components/explore/explore-card.tsx
index 8d430e16..389870fb 100644
--- a/src/components/explore/explore-card.tsx
+++ b/src/components/explore/explore-card.tsx
@@ -19,6 +19,14 @@ const BORDERS_BY_DIFFICULTY = {
'dark:hover:border-orange-300 hover:border-orange-500 dark:group-focus:border-orange-300 group-focus:border-orange-500',
};
+const SHADOWS_BY_DIFFICULTY = {
+ BEGINNER: 'hover:shadow-[0_0_1rem_-0.5rem_#f9a8d4,inset_0_0_1rem_-0.5rem_#f9a8d4]',
+ EASY: 'hover:shadow-[0_0_1rem_-0.5rem_#86efac,inset_0_0_1rem_-0.5rem_#86efac]',
+ MEDIUM: 'hover:shadow-[0_0_1rem_-0.5rem_#fde047,inset_0_0_1rem_-0.5rem_#fde047]',
+ HARD: 'hover:shadow-[0_0_1rem_-0.5rem_#fca5a5,inset_0_0_1rem_-0.5rem_#fca5a5]',
+ EXTREME: 'hover:shadow-[0_0_1rem_-0.5rem_#fdba74,inset_0_0_1rem_-0.5rem_#fdba74]',
+};
+
// in miliseconds
const units = {
year: 24 * 60 * 60 * 1000 * 365,
@@ -47,12 +55,16 @@ const getRelativeTime = (date) => {
export function ExploreCard({ challenge }: Props) {
return (
- <Card className={`duration-300 ${BORDERS_BY_DIFFICULTY[challenge.difficulty]}`}>
+ <Card
+ className={`hover:bg-card-hovered group duration-300 ${
+ SHADOWS_BY_DIFFICULTY[challenge.difficulty]
+ } ${BORDERS_BY_DIFFICULTY[challenge.difficulty]}`}
+ >
<CardHeader className="grid items-start gap-4 space-y-0">
<div className="space-y-1">
<CardTitle>{challenge.name}</CardTitle>
<CardDescription className="relative h-48 overflow-hidden pb-4">
- <div className="pointer-events-none absolute inset-0 h-full w-full shadow-[inset_0_-1.5rem_1rem_-0.5rem_hsl(var(--card))]"></div>
+ <div className="pointer-events-none absolute inset-0 h-full w-full shadow-[inset_0_-1.5rem_1rem_-0.5rem_hsl(var(--card))] duration-300 group-hover:shadow-[inset_0_-1.5rem_1rem_-0.5rem_hsl(var(--card-hovered))]" />
{challenge.description}
</CardDescription>
</div>
diff --git a/src/styles/globals.css b/src/styles/globals.css
index 61e4b883..3f0c207e 100644
--- a/src/styles/globals.css
+++ b/src/styles/globals.css
@@ -1,73 +1,74 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
-
+
@layer base {
:root {
--background: 0 0% 100%;
--foreground: 240 10% 3.9%;
-
+
--muted: 240 4.8% 95.9%;
--muted-foreground: 240 3.8% 46.1%;
-
+
--popover: 0 0% 100%;
--popover-foreground: 240 10% 3.9%;
-
+
--card: 0 0% 100%;
--card-foreground: 240 10% 3.9%;
-
+
--border: 240 5.9% 90%;
--input: 240 5.9% 90%;
-
+
--primary: 240 5.9% 10%;
--primary-foreground: 0 0% 98%;
-
+
--secondary: 240 4.8% 95.9%;
--secondary-foreground: 240 5.9% 10%;
-
+
--accent: 240 4.8% 95.9%;
--accent-foreground: ;
-
+
--destructive: 0 84.2% 60.2%;
--destructive-foreground: 0 0% 98%;
-
+
--ring: 240 5% 64.9%;
-
+
--radius: 0.5rem;
}
-
+
.dark {
--background: 240 10% 3.9%;
--foreground: 0 0% 98%;
-
+
--muted: 240 3.7% 15.9%;
--muted-foreground: 240 5% 64.9%;
-
+
--popover: 240 10% 3.9%;
--popover-foreground: 0 0% 98%;
-
+
--card: 240 10% 3.9%;
+ --card-hovered: 240 10% 6.9%;
--card-foreground: 0 0% 98%;
-
+
--border: 240 3.7% 15.9%;
--input: 240 3.7% 15.9%;
-
+
--primary: 0 0% 98%;
--primary-foreground: 240 5.9% 10%;
-
+
--secondary: 240 3.7% 15.9%;
--secondary-foreground: 0 0% 98%;
-
+
--accent: 240 3.7% 15.9%;
--accent-foreground: ;
-
+
--destructive: 0 62.8% 30.6%;
--destructive-foreground: 0 85.7% 97.3%;
-
+
--ring: 240 3.7% 15.9%;
}
}
-
+
@layer base {
* {
@apply border-border;
@@ -77,6 +78,9 @@
}
}
-html, body, #__next, main {
+html,
+body,
+#__next,
+main {
height: 100%;
}
diff --git a/tailwind.config.js b/tailwind.config.js
index 0377ea1d..a5e24797 100644
--- a/tailwind.config.js
+++ b/tailwind.config.js
@@ -1,76 +1,77 @@
/** @type {import('tailwindcss').Config} */
module.exports = {
- darkMode: ["class"],
+ darkMode: ['class'],
content: [
'./pages/**/*.{ts,tsx}',
'./components/**/*.{ts,tsx}',
'./app/**/*.{ts,tsx}',
'./src/**/*.{ts,tsx}',
- ],
+ ],
theme: {
container: {
center: true,
- padding: "2rem",
+ padding: '2rem',
screens: {
- "2xl": "1400px",
+ '2xl': '1400px',
},
},
extend: {
colors: {
- border: "hsl(var(--border))",
- input: "hsl(var(--input))",
- ring: "hsl(var(--ring))",
- background: "hsl(var(--background))",
- foreground: "hsl(var(--foreground))",
+ border: 'hsl(var(--border))',
+ input: 'hsl(var(--input))',
+ ring: 'hsl(var(--ring))',
+ background: 'hsl(var(--background))',
+ foreground: 'hsl(var(--foreground))',
primary: {
- DEFAULT: "hsl(var(--primary))",
- foreground: "hsl(var(--primary-foreground))",
+ DEFAULT: 'hsl(var(--primary))',
+ foreground: 'hsl(var(--primary-foreground))',
},
secondary: {
- DEFAULT: "hsl(var(--secondary))",
- foreground: "hsl(var(--secondary-foreground))",
+ DEFAULT: 'hsl(var(--secondary))',
+ foreground: 'hsl(var(--secondary-foreground))',
},
destructive: {
- DEFAULT: "hsl(var(--destructive))",
- foreground: "hsl(var(--destructive-foreground))",
+ DEFAULT: 'hsl(var(--destructive))',
+ foreground: 'hsl(var(--destructive-foreground))',
},
muted: {
- DEFAULT: "hsl(var(--muted))",
- foreground: "hsl(var(--muted-foreground))",
+ DEFAULT: 'hsl(var(--muted))',
+ foreground: 'hsl(var(--muted-foreground))',
},
accent: {
- DEFAULT: "hsl(var(--accent))",
- foreground: "hsl(var(--accent-foreground))",
+ DEFAULT: 'hsl(var(--accent))',
+ foreground: 'hsl(var(--accent-foreground))',
},
popover: {
- DEFAULT: "hsl(var(--popover))",
- foreground: "hsl(var(--popover-foreground))",
+ DEFAULT: 'hsl(var(--popover))',
+ foreground: 'hsl(var(--popover-foreground))',
},
card: {
- DEFAULT: "hsl(var(--card))",
- foreground: "hsl(var(--card-foreground))",
+ DEFAULT: 'hsl(var(--card))',
+ hovered: 'hsl(var(--card-hovered))',
+ foreground: 'hsl(var(--card-foreground))',
},
},
borderRadius: {
- lg: "var(--radius)",
- md: "calc(var(--radius) - 2px)",
- sm: "calc(var(--radius) - 4px)",
+ lg: 'var(--radius)',
+ md: 'calc(var(--radius) - 2px)',
+ sm: 'calc(var(--radius) - 4px)',
},
keyframes: {
- "accordion-down": {
+ 'accordion-down': {
from: { height: 0 },
- to: { height: "var(--radix-accordion-content-height)" },
+ to: { height: 'var(--radix-accordion-content-height)' },
},
- "accordion-up": {
- from: { height: "var(--radix-accordion-content-height)" },
+ 'accordion-up': {
+ from: { height: 'var(--radix-accordion-content-height)' },
to: { height: 0 },
},
},
animation: {
- "accordion-down": "accordion-down 0.2s ease-out",
- "accordion-up": "accordion-up 0.2s ease-out",
+ 'accordion-down': 'accordion-down 0.2s ease-out',
+ 'accordion-up': 'accordion-up 0.2s ease-out',
},
},
},
- plugins: [require("tailwindcss-animate")],
-}
\ No newline at end of file
+ plugins: [require('tailwindcss-animate')],
+};
diff --git a/tailwind.config.ts b/tailwind.config.ts
index 72e0c93e..029d7a34 100644
--- a/tailwind.config.ts
+++ b/tailwind.config.ts
@@ -45,6 +45,7 @@ module.exports = {
},
card: {
DEFAULT: 'hsl(var(--card))',
+ hovered: 'hsl(var(--card-hovered))',
foreground: 'hsl(var(--card-foreground))',
},
},