Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
588 changes: 370 additions & 218 deletions src/components/auth/DashboardLayout.tsx

Large diffs are not rendered by default.

42 changes: 20 additions & 22 deletions src/components/learning/BookmarkButton.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@

import React from "react";
import React, { useCallback } from "react";
// @ts-ignore
import { useLearning } from "@site/src/context/LearningContext";
// @ts-ignore
import type { BookmarkType } from "@site/src/types/learning";
import { FaRegBookmark, FaBookmark } from 'react-icons/fa';

interface BookmarkButtonProps {
id: string;
Expand All @@ -23,43 +23,41 @@ export default function BookmarkButton({
compact = false,
}: BookmarkButtonProps) {
const { isBookmarked, toggleBookmark } = useLearning();

const saved = isBookmarked(id);

function handleClick() {
const handleClick = useCallback((e: React.MouseEvent<HTMLButtonElement>) => {
e.preventDefault();
toggleBookmark({
id,
title,
url,
type,
description,
});
}
}, [id, title, url, type, description, toggleBookmark]);

return (
<button
type="button"
onClick={handleClick}
aria-pressed={saved}
aria-label={
saved
? `Remove ${title} from bookmarks`
: `Bookmark ${title}`
}
title={saved ? "Remove bookmark" : "Save bookmark"}
className="inline-flex items-center justify-center gap-2 rounded-xl border px-4 py-2.5 text-sm font-semibold transition hover:-translate-y-0.5"
style={{
color: saved ? "var(--ifm-color-primary)" : "var(--ifm-font-color-base)",
borderColor: saved
? "var(--ifm-color-primary)"
: "var(--ifm-color-emphasis-300)",
background: saved
? "color-mix(in srgb, var(--ifm-color-primary) 10%, transparent)"
: "var(--ifm-background-surface-color)",
aria-label={saved ? 'Remove bookmark' : 'Add bookmark'}
title={saved ? 'Remove bookmark' : 'Add bookmark'}
className={`bookmark-btn ${saved ? 'bookmark-active' : ''}`}
style={{
background: 'none',
border: 'none',
cursor: 'pointer',
fontSize: '1.25rem',
padding: '4px',
display: 'inline-flex',
alignItems: 'center',
justifyContent: 'center',
color: saved ? 'var(--ifm-color-primary)' : 'var(--ifm-color-emphasis-600)',
transition: 'color 0.2s ease'
}}
>
<span aria-hidden="true">{saved ? "★" : "☆"}</span>
{!compact && (saved ? "Saved" : "Bookmark")}
{!compact && (saved ? <FaBookmark /> : <FaRegBookmark />)}
</button>
);
}
139 changes: 139 additions & 0 deletions src/pages/bookmarks/bookmarks.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
.container {
width: min(1100px, calc(100% - 2rem));
margin: 3rem auto;
min-height: 70vh;
}

.hero {
text-align: center;
padding: 3rem 1rem;
border-radius: 24px;
background: var(--ifm-color-emphasis-100);
}

.eyebrow {
font-size: 0.75rem;
font-weight: 800;
letter-spacing: 0.15em;
color: var(--ifm-color-primary);
}

.hero h1 {
margin: 1rem 0;
font-size: clamp(2.2rem, 6vw, 3.5rem);
}

.hero h1 span {
color: var(--ifm-color-primary);
}

.hero p {
max-width: 600px;
margin: auto;
color: var(--ifm-color-emphasis-700);
}

.stats {
display: flex;
justify-content: center;
gap: 3rem;
margin-top: 2rem;
}

.stats div {
display: flex;
flex-direction: column;
gap: 0.3rem;
}

.stats strong {
font-size: 1.8rem;
}

.stats span {
color: var(--ifm-color-emphasis-700);
font-size: 0.85rem;
}

.toolbar {
display: grid;
grid-template-columns: 2fr 1fr 1fr;
gap: 1rem;
margin: 2rem 0 1rem;
}

.toolbar input,
.toolbar select {
min-width: 0;
padding: 0.8rem;
border: 1px solid var(--ifm-color-emphasis-300);
border-radius: 10px;
background: var(--ifm-background-surface-color);
color: var(--ifm-font-color-base);
}

.actions {
display: flex;
gap: 0.75rem;
flex-wrap: wrap;
margin-bottom: 1.5rem;
}

.actions button {
padding: 0.65rem 1rem;
border: 1px solid var(--ifm-color-emphasis-300);
border-radius: 9px;
background: var(--ifm-background-surface-color);
color: var(--ifm-font-color-base);
cursor: pointer;
}

.actions button:hover {
border-color: var(--ifm-color-primary);
}

.actions .danger {
color: var(--ifm-color-danger);
}

.grid {
display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr));
gap: 1rem;
}

.empty {
padding: 4rem 1rem;
text-align: center;
border: 1px dashed var(--ifm-color-emphasis-400);
border-radius: 20px;
}

.empty p {
color: var(--ifm-color-emphasis-700);
}

.emptyIcon {
font-size: 3rem;
margin-bottom: 1rem;
}

@media (max-width: 800px) {
.grid {
grid-template-columns: repeat(2, minmax(0, 1fr));
}

.toolbar {
grid-template-columns: 1fr;
}
}

@media (max-width: 550px) {
.grid {
grid-template-columns: 1fr;
}

.stats {
gap: 1.5rem;
}
}
Loading
Loading