Skip to content

Commit

Permalink
fix color combination between light or dark theme
Browse files Browse the repository at this point in the history
  • Loading branch information
FarrelAD committed Sep 21, 2024
1 parent df081ff commit a8306b3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ const router = createBrowserRouter(
function App() {
const theme = useSelector((state) => state.theme.theme)

const appThemeClass = theme === 'dark' ? 'bg-slate-800 text-white' : 'bg-white text-black'
const appThemeClass = theme === 'dark' ? 'bg-slate-800 text-white' : 'bg-slate-300 text-black'

return (
<div className={`${appThemeClass} bg-slate-800 text-white min-h-screen`}>
<div className={`${appThemeClass} min-h-screen`}>
<RouterProvider router={router} />
</div>
)
Expand Down
6 changes: 5 additions & 1 deletion src/components/Card.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useNavigate } from 'react-router-dom'
import { useSelector } from 'react-redux'
import PropTypes from 'prop-types'

function CardMenuList({shape, title}) {
Expand Down Expand Up @@ -29,13 +30,16 @@ function CardMenuBox() {

function Card({id, isMenuActive, toggleDetail, blogTitle, blogWriter, writerPhotoProfile, blogImageUrl , blogWrittenDate}) {
const navigate = useNavigate()
const theme = useSelector((state) => state.theme.theme)

const cardThemeClass = theme === 'dark' ? 'bg-slate-950 shadow-slate-600 hover:shadow-slate-400' : 'bg-slate-100 shadow-slate-400 hover:shadow-slate-200'

const navigateDetail = () => {
navigate(`/blog/${blogTitle}`)
}

return (
<div className="mx-auto blog-card bg-slate-950 rounded-lg w-80 m-4 shadow-lg shadow-slate-600 hover:cursor-pointer hover:shadow-slate-400 transition-shadow" onClick={navigateDetail}>
<div className={`mx-auto blog-card ${cardThemeClass} rounded-lg w-80 m-4 shadow-lg hover:cursor-pointer transition-shadow`} onClick={navigateDetail}>
<img src={blogImageUrl} alt="Card image" className="min-w-full h-48 rounded-t-lg object-cover" />
<div className="p-4">
<h1 className="blog-title font-bold">{blogTitle}</h1>
Expand Down

0 comments on commit a8306b3

Please sign in to comment.