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

Fix: Dark & Light mode #82

Closed
wants to merge 0 commits into from
Closed

Conversation

anmol-fzr
Copy link

Fix: homepage having only light header and rest page in dark mode, now all adapts to one theme either light or dark

Description

  • Issue: Add light mode to the main landing page #49
  • Before this PR the studiocms homepage has mixed theme, Hero component has light mode and rest page has dark mode, with this PR whole page adapts to either light or dark mode

@jdtjenkins
Copy link
Contributor

@anmol-fzr Hey! Thank you so much for this PR! 💪

I'm just looking at it on the preview and it doesn't seem to change based on what preference you've set in the browser. I'm on latest Chrome on Windows.

Also changing in the devtools -> Rendering -> Emulate CSS media feature doesn't change it either.

But when I remove the dark from the html tag, I can see the light theme. So it's good! Just doesn't seem to be automatically updating

@@ -29,4 +29,5 @@ export default {
},
},
plugins: [require('tailwind-scrollbar')],
darkMode: "class"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
darkMode: "class"
darkMode: "selector"

The selector strategy replaced the class strategy in Tailwind CSS v3.4.1.
src: https://tailwindcss.com/docs/dark-mode#toggling-dark-mode-manually

@Adammatthiesen Adammatthiesen added bug Something isn't working enhancement New feature or request chore style awaiting review(s) labels May 15, 2024
Copy link
Member

@at-the-vr at-the-vr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey Anmol 👋 Great start with this PR 💯 I have left some comments for you to check whenever your free 😉. Definitely a brain teaser when considering a Theme Selector as well. Incase you are facing any difficulties, do share them here

@@ -13,11 +13,11 @@ const { icon, description, feature } = Astro.props
<div
class='animate-border rounded-lg border border-transparent [background:linear-gradient(45deg,#172033,theme(colors.slate.800)_50%,#172033)_padding-box,conic-gradient(from_var(--border-angle),theme(colors.slate.600/.48)_80%,_theme(colors.indigo.500)_86%,_theme(colors.indigo.300)_90%,_theme(colors.indigo.500)_94%,_theme(colors.slate.600/.48))_border-box]'
>
<div class='h-full place-self-center rounded-lg bg-[--purple-900] p-10'>
<div class='flex items-center justify-center gap-2 pb-6'>
<div class='h-full place-self-center rounded-lg bg-[--slate-100] dark:bg-[--purple-900] p-10'>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--slate-100 is not a defined variable in globals.css it should be updated to bg-slate-100

@@ -6,7 +6,7 @@ import Footer from '../components/Footer.astro'
---

<html
class='scrollbar scrollbar-thumb-white scrollbar-track-[#1a172e] h-32 overflow-y-scroll'
class='scrollbar scrollbar-thumb-white scrollbar-track-[#1a172e] h-32 overflow-y-scroll dark'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dark in itself is just a variant for tailwind, best to remove this as its not doing anything

}

body {
@apply bg-[--purple-900] text-white dark:bg-[--purple-900] dark:text-slate-100;
font-family: 'zenkaku';
@apply bg-[--slate-100] text-[--purple-900] dark:bg-[--purple-900] dark:text-[--slate-100];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

similar suggestion bg-slate-100 text-[--purple-900] dark:bg-[--purple-900] dark:text-slate-100;

@ghost
Copy link

ghost commented May 16, 2024

The preview deployment is in progress. 🟡

Open Build Logs

Last updated at: 2024-05-16 15:39:45 CET

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting review(s) bug Something isn't working chore enhancement New feature or request style
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants