ahmedqaram
ahmedqaram
TTCTheo's Typesafe Cult
Created by ahmedqaram on 8/23/2023 in #questions
switch image based on light and dark mode doesn't work well ?
here i need to swap between 2 images based on theme mode like if it light i need logo-1 but if it dark i need it to be logo-2 with using this code from below but no luck import { unstable_getImgProps as getImgProps } from 'next/image' export function Logo() { const common = { alt: 'logo', width: 40, height: 30 } const { props: { srcSet: dark } } = getImgProps({ ...common, src: '/images/logo/logo.webp' }) const { props: { srcSet: light , ...rest } } = getImgProps({ ...common, src: '/images/logo/logo-2.webp' }) return ( <picture> <source media="(prefers-color-scheme: dark)" srcSet={dark} /> <source media="(prefers-color-scheme: light )" srcSet={light} /> <img {...rest} /> </picture> ) } it's working on dark mode if i swap between 2 images it just worked fine but no luck with light mode it doesn't update at all if i switching between light and dark does anyone has similar issue and how i can fix it ?
42 replies
TTCTheo's Typesafe Cult
Created by ahmedqaram on 10/28/2022 in #questions
why grpc considered as a joke?
in this video i was watching early theo says that grapc is a joke https://www.youtube.com/watch?v=jd5JwXoDXFo i need to know why mabye that save my time insted of learn it
30 replies