Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ENHANCEMENT] Polish the dark mode; Overhaul submit form; Fix dark mode skeleton components; #67

Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
e9a320a
feat: Add `dark` color to the theme
chinmaykunkikar Nov 30, 2023
afa1350
feat: Completey overhaul the Create blog form
chinmaykunkikar Nov 30, 2023
17f652c
chore: Remove stale css dark theme variables
chinmaykunkikar Nov 30, 2023
75c4c2c
refactor: Changed all colors from *-gray-* and white to *-slate-* or …
chinmaykunkikar Nov 30, 2023
583eb97
refactor: Overhaul the homepage
chinmaykunkikar Nov 30, 2023
a5f779b
style: Remove some unnecessary `tracking`
chinmaykunkikar Dec 1, 2023
955d2d0
fix: Use margin instead of padding
chinmaykunkikar Dec 1, 2023
286a6a7
fix: Add classes to make the app more responsive on smaller screens
chinmaykunkikar Dec 1, 2023
ea05ef3
feat: Add a `light` theme to tailwind config
chinmaykunkikar Dec 1, 2023
fe49972
fix: Remove Latest post border in dark mode
chinmaykunkikar Dec 1, 2023
cd40261
style: Use original breakpoint widths for cards
chinmaykunkikar Dec 1, 2023
62088b1
feat: Add skeletons for dark mode (fixes #64)
chinmaykunkikar Dec 1, 2023
4f5f5b9
styles: Add custom font to tailwind config
chinmaykunkikar Dec 1, 2023
842ecf7
styles: Add some visual hierarchy by adjusting text sizes.
chinmaykunkikar Dec 1, 2023
2612958
styles: Overhaul modal styling; add dark mode
chinmaykunkikar Dec 1, 2023
ce2f99a
styles: Change some styles of the submit form again
chinmaykunkikar Dec 1, 2023
6efdfd1
feat: Introduce a `CategoryPill` component to replace `category-props`
chinmaykunkikar Dec 1, 2023
89fb796
fix: Fix category pill colors
chinmaykunkikar Dec 1, 2023
9f5a0d3
chore: Run `prettier`
chinmaykunkikar Dec 1, 2023
2fe4e5f
styles: Fix `DetailsPage` styling according to themes
chinmaykunkikar Dec 2, 2023
a227346
style: Make add blog page mobile responsive; Move header along the form;
chinmaykunkikar Dec 2, 2023
758448d
refactor: `normalColor` -> `defaultColor`
chinmaykunkikar Dec 2, 2023
56c7b8f
refactor: Add a util to get categories and their respective colors
chinmaykunkikar Dec 4, 2023
28ac078
styles: Fix navigation button alignments on blog and details pages
chinmaykunkikar Dec 4, 2023
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
32 changes: 16 additions & 16 deletions frontend/src/components/blog-feed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,26 +43,26 @@ export default function BlogFeed() {
<div className="container mx-auto py-6">
<div className="-mx-4 flex flex-wrap">
<div className="w-full p-4 md:w-2/3">
<h1 className="mb-4 text-2xl font-semibold dark:text-white">
<h1 className="mb-4 text-2xl font-semibold dark:text-dark-primary">
{selectedCategory === 'featured'
? 'Featured Posts'
: `Posts related to "${selectedCategory}"`}
</h1>
<div className="flex flex-col gap-4">
<div className="flex flex-col gap-6">
{posts.length === 0
? Array(5)
.fill(0)
.map((_, index) => <FeaturedPostCardSkeleton key={index} />)
.fill(0)
.map((_, index) => <FeaturedPostCardSkeleton key={index} />)
: posts
.slice(0, 5)
.map((post, index) => <FeaturedPostCard key={index} post={post} />)}
.slice(0, 5)
.map((post, index) => <FeaturedPostCard key={index} post={post} />)}
</div>
</div>
<div className="w-full p-4 md:w-1/3">
<div className="mb-6">
<div className="text-gray-500 dark:text-white">Discover by topic</div>
<h2 className="mb-4 text-2xl font-semibold dark:text-white">Categories</h2>
<div className="flex flex-wrap gap-2">
<div className="-mb-1 tracking-wide text-slate-500 dark:text-dark-tertiary">Discover by topic</div>
<h2 className="mb-2 text-2xl font-semibold dark:text-dark-primary">Categories</h2>
<div className="flex flex-wrap gap-3 dark:bg-dark-card dark:p-3 dark:rounded-lg">
{CATEGORIES.map((category) => (
<button
key={category}
Expand All @@ -81,16 +81,16 @@ export default function BlogFeed() {
</div>
</div>
<div>
<div className="text-gray-500 dark:text-white">What's new ?</div>
<h2 className="mb-4 text-2xl font-semibold dark:text-white">Latest Posts</h2>
<div className="flex flex-col gap-2">
<div className="-mb-1 tracking-wide text-slate-500 dark:text-dark-tertiary">What's new?</div>
<h2 className="mb-2 text-2xl font-semibold dark:text-dark-primary">Latest Posts</h2>
<div className="flex flex-col gap-4">
{latestPosts.length === 0
? Array(5)
.fill(0)
.map((_, index) => <LatestPostCardSkeleton key={index} />)
.fill(0)
.map((_, index) => <LatestPostCardSkeleton key={index} />)
: latestPosts
.slice(0, 5)
.map((post, index) => <LatestPostCard key={index} post={post} />)}
.slice(0, 5)
.map((post, index) => <LatestPostCard key={index} post={post} />)}
</div>
</div>
</div>
Expand Down
14 changes: 7 additions & 7 deletions frontend/src/components/featured-post-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,29 @@ export default function FeaturedPostCard({ post }: { post: Post }) {
const navigate = useNavigate();
return (
<div
className="flex h-48 cursor-pointer gap-4 rounded-lg bg-white p-2 dark:bg-dark-textfield"
className="flex h-48 cursor-pointer gap-2 rounded-lg bg-slate-50 dark:bg-dark-card"
onClick={() => navigate('/details-page', { state: { post } })}
>
<div className="w-1/3">
<img
src={post.imageLink}
alt={post.title}
className="h-full w-full rounded-lg object-cover"
className="h-full w-full rounded-lg object-cover shadow-lg"
/>
</div>
<div className="flex h-full w-2/3 flex-col gap-2">
<div className="text-xl font-semibold dark:text-white">{post.title}</div>
<div className="flex h-full w-2/3 flex-col gap-2 p-2">
<div className="text-xl font-semibold dark:text-dark-title">{post.title}</div>
<div className="flex flex-wrap gap-2">
{post.categories.map((category, index) => (
<span key={index} className={categoryProps(category)}>
{category}
</span>
))}
</div>
<div className="line-clamp-2 text-gray-600">
<p className="overflow-ellipsis dark:text-white">{post.description}</p>
<div className="line-clamp-2 text-slate-700">
<p className="overflow-ellipsis dark:text-dark-description">{post.description}</p>
</div>
<div className="mb-1 flex flex-1 items-end text-xs text-gray-500 dark:text-white">
<div className="flex flex-1 items-end text-xs text-slate-600 dark:text-dark-info">
{post.authorName} • {formatPostTime(post.timeOfPost)}
</div>
</div>
Expand Down
8 changes: 4 additions & 4 deletions frontend/src/components/latest-post-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ export default function LatestPostCard({ post }: { post: Post }) {
const navigate = useNavigate();
return (
<div
className="cursor-pointer rounded-lg bg-white p-2 py-2 shadow-sm dark:bg-dark-textfield"
className="cursor-pointer rounded-lg bg-slate-50 p-3 shadow-sm dark:bg-dark-card"
onClick={() => navigate('/details-page', { state: { post } })}
>
<div className="flex">
<div className="mb-2 flex flex-1 flex-wrap gap-2 ">
<div className="mb-2 flex flex-1 flex-wrap gap-2">
{post.categories.map((category, index) => (
<span key={index} className={categoryProps(category)}>
{category}
Expand All @@ -20,8 +20,8 @@ export default function LatestPostCard({ post }: { post: Post }) {
</div>
<img src={linkIcon} className="h-3 w-3" onClick={() => navigate(-1)} />
</div>
<div className="mb-2 line-clamp-2 text-xl font-semibold dark:text-white">{post.title}</div>
<div className="text-xs text-gray-500 dark:text-white">
<div className="mb-2 line-clamp-2 font-semibold dark:text-dark-title">{post.title}</div>
<div className="text-xs text-slate-500 dark:text-dark-info">
{post.authorName} • {formatPostTime(post.timeOfPost)}
</div>
</div>
Expand Down
14 changes: 7 additions & 7 deletions frontend/src/components/modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@ const ModalComponent: React.FC<ModalProps> = ({
role="dialog"
aria-modal="false"
>
<div className="fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity"></div>
<div className="fixed inset-0 bg-slate-500 bg-opacity-75 transition-opacity"></div>

<div className="fixed inset-0 z-10 w-screen overflow-y-auto">
<div className="flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0">
<div className="relative transform overflow-hidden rounded-lg bg-white text-left shadow-xl transition-all sm:my-8 sm:w-full sm:max-w-lg">
<div className="bg-white px-4 pb-4 pt-5 sm:p-6 sm:pb-4">
<div className="relative transform overflow-hidden rounded-lg bg-slate-50 text-left shadow-xl transition-all sm:my-8 sm:w-full sm:max-w-lg">
<div className="bg-slate-50 px-4 pb-4 pt-5 sm:p-6 sm:pb-4">
<div className="sm:flex sm:items-start">
<div className="mt-3 text-center sm:ml-4 sm:mt-0 sm:text-left">
<h3
className="text-base font-semibold leading-6 text-gray-900"
className="text-base font-semibold leading-6 text-slate-900"
id="modal-title"
>
Select Post Image
Expand All @@ -44,7 +44,7 @@ const ModalComponent: React.FC<ModalProps> = ({
<div
key={imageUrl}
className={`cursor-pointer border p-2 ${
selectedImage === imageUrl ? 'border-blue-500' : 'border-gray-300'
selectedImage === imageUrl ? 'border-blue-500' : 'border-slate-300'
} rounded-md`}
onClick={() => handleImageSelect(imageUrl)}
>
Expand All @@ -60,7 +60,7 @@ const ModalComponent: React.FC<ModalProps> = ({
</div>
</div>
</div>
<div className="bg-gray-50 px-4 py-3 sm:flex sm:flex-row-reverse sm:px-6">
<div className="bg-slate-50 px-4 py-3 sm:flex sm:flex-row-reverse sm:px-6">
<button
type="button"
name="imageLink"
Expand All @@ -71,7 +71,7 @@ const ModalComponent: React.FC<ModalProps> = ({
</button>
<button
type="button"
className="mt-3 inline-flex w-full justify-center rounded-md bg-white px-3 py-2 text-sm font-semibold text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 hover:bg-gray-50 sm:mt-0 sm:w-auto"
className="mt-3 inline-flex w-full justify-center rounded-md bg-slate-50 px-3 py-2 text-sm font-semibold text-slate-900 shadow-sm ring-1 ring-inset ring-slate-300 hover:bg-slate-50 sm:mt-0 sm:w-auto"
onClick={() => {
setModal(false);
}}
Expand Down
14 changes: 9 additions & 5 deletions frontend/src/components/post-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,23 @@ export default function PostCard({ post }: { post: Post }) {
className="w-full cursor-pointer p-4 md:w-1/2 lg:w-1/3 xl:w-1/4"
onClick={() => navigate('/details-page', { state: { post } })}
>
<div className="rounded-lg bg-white shadow-md dark:bg-dark-textfield">
<div className="rounded-lg bg-slate-50 shadow-md dark:bg-dark-card">
<img
src={post.imageLink}
alt={post.title}
className="h-48 w-full rounded-lg object-cover"
/>
<div className="p-4">
<div className="mb-2 text-xs text-gray-500 dark:text-white">
<div className="mb-2 text-xs text-slate-500 dark:text-slate-400">
{post.authorName} • {formatPostTime(post.timeOfPost)}
</div>
<h2 className="mb-2 line-clamp-1 text-xl font-semibold dark:text-white">{post.title}</h2>
<p className="line-clamp-2 text-gray-600 dark:text-white">{post.description}</p>
<div className="mt-4 flex flex-wrap gap-2 dark:text-black">
<h2 className="mb-2 line-clamp-1 text-xl font-semibold dark:text-slate-50">
{post.title}
</h2>
<p className="line-clamp-2 text-slate-600 dark:text-dark-description">
{post.description}
</p>
<div className="mt-4 flex flex-wrap gap-2">
{post.categories.map((category, index) => (
<span key={index} className={categoryProps(category)}>
{category}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,26 @@ import { Skeleton } from '@/components/ui/skeleton';

export const FeaturedPostCardSkeleton = () => {
return (
<div className="flex h-48 gap-4 rounded-lg bg-white">
<div className="flex h-48 gap-4 rounded-lg bg-slate-50">
<div className="w-1/3">
{/* for image */}
<Skeleton className="h-full w-full rounded-lg bg-gray-200" />
<Skeleton className="h-full w-full rounded-lg bg-slate-200" />
</div>
<div className="flex h-full w-2/3 flex-col gap-2">
{/* for title */}
<Skeleton className="h-6 w-full bg-gray-200 text-xl" />
<Skeleton className="h-6 w-2/3 bg-gray-200 text-xl" />
<Skeleton className="h-6 w-full bg-slate-200 text-xl" />
<Skeleton className="h-6 w-2/3 bg-slate-200 text-xl" />
<div className="flex flex-wrap gap-2">
{/* for categories */}
<Skeleton className="h-6 w-16 rounded-3xl bg-gray-200" />
<Skeleton className="h-6 w-16 rounded-3xl bg-gray-200" />
<Skeleton className="h-6 w-16 rounded-3xl bg-gray-200" />
<Skeleton className="h-6 w-16 rounded-3xl bg-slate-200" />
<Skeleton className="h-6 w-16 rounded-3xl bg-slate-200" />
<Skeleton className="h-6 w-16 rounded-3xl bg-slate-200" />
</div>
{/* for description */}
<Skeleton className="line-clamp-2 h-12 w-full bg-gray-200" />
<Skeleton className="line-clamp-2 h-12 w-full bg-slate-200" />
<div className="mb-1 flex flex-1 items-end">
{/* for author and time */}
<Skeleton className="h-5 w-1/3 bg-gray-200" />
<Skeleton className="h-5 w-1/3 bg-slate-200" />
</div>
</div>
</div>
Expand Down
18 changes: 9 additions & 9 deletions frontend/src/components/skeletons/latest-post-card-skeleton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@ import { Skeleton } from '@/components/ui/skeleton';

export const LatestPostCardSkeleton = () => {
return (
<div className="rounded-lg bg-white py-2 shadow-sm">
<div className="rounded-lg bg-slate-50 py-2 shadow-sm">
<div className="flex">
<div className="mb-2 flex flex-1 flex-wrap gap-2">
<Skeleton className="h-6 w-16 rounded-3xl bg-gray-200" />
<Skeleton className="h-6 w-16 rounded-3xl bg-gray-200" />
<Skeleton className="h-6 w-16 rounded-3xl bg-gray-200" />
<Skeleton className="h-6 w-16 rounded-3xl bg-slate-200" />
<Skeleton className="h-6 w-16 rounded-3xl bg-slate-200" />
<Skeleton className="h-6 w-16 rounded-3xl bg-slate-200" />
</div>
<Skeleton className="h-4 w-4 bg-gray-200" style={{ height: 12, width: 12 }} />
<Skeleton className="h-4 w-4 bg-slate-200" style={{ height: 12, width: 12 }} />
</div>
<div className="mb-2 line-clamp-2 text-xl font-semibold">
<Skeleton className="h-6 w-full bg-gray-200" />
<Skeleton className="mt-2 h-6 w-2/3 bg-gray-200" />
<Skeleton className="h-6 w-full bg-slate-200" />
<Skeleton className="mt-2 h-6 w-2/3 bg-slate-200" />
</div>
<div className="flex text-xs text-gray-500">
<Skeleton className="h-4 w-1/3 bg-gray-200" />
<div className="flex text-xs text-slate-500">
<Skeleton className="h-4 w-1/3 bg-slate-200" />
</div>
</div>
);
Expand Down
14 changes: 7 additions & 7 deletions frontend/src/components/skeletons/post-card-skeleton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ import { Skeleton } from '@/components/ui/skeleton';
export const PostCardSkeleton = () => {
return (
<div className="w-full p-4 md:w-1/2 lg:w-1/3 xl:w-1/4">
<div className="rounded-lg bg-white shadow-md">
<div className="rounded-lg bg-slate-50 shadow-md">
<Skeleton className="h-48 w-full rounded-lg" />
<div className="p-4">
<div className="mb-2 flex text-xs text-gray-500">
<Skeleton className="mr-2 h-4 w-2/3 bg-gray-200" />
<div className="mb-2 flex text-xs text-slate-500">
<Skeleton className="mr-2 h-4 w-2/3 bg-slate-200" />
</div>
<Skeleton className="mb-2 h-6 w-4/5 bg-gray-200" />
<Skeleton className="line-clamp-2 h-14 w-full bg-gray-200 text-gray-600" />
<Skeleton className="mb-2 h-6 w-4/5 bg-slate-200" />
<Skeleton className="line-clamp-2 h-14 w-full bg-slate-200 text-slate-600" />
<div className="mt-4 flex flex-wrap gap-2">
<Skeleton className="h-6 w-16 rounded-3xl bg-gray-200" />
<Skeleton className="h-6 w-16 rounded-3xl bg-gray-200" />
<Skeleton className="h-6 w-16 rounded-3xl bg-slate-200" />
<Skeleton className="h-6 w-16 rounded-3xl bg-slate-200" />
</div>
</div>
</div>
Expand Down
7 changes: 0 additions & 7 deletions frontend/src/index.css
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
@tailwind base;
@tailwind components;
@tailwind utilities;

@layer base {
:root {
--color-dark-background: #10172a;
--color-dark-textfield-card: #1d293c;
}
}
Loading