diff --git a/src/App.jsx b/src/App.jsx index cdd5299..1228c19 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -5,6 +5,7 @@ import { Loading } from './components/Loading'; import { ProtectedRoute } from './components/ProtectedRoute'; import { useAuth, useShoppingListData, useShoppingLists } from './api'; import { useStateWithStorage } from './utils'; +import { ThemeProvider } from './context/ThemeContext'; export function App() { /** @@ -41,42 +42,44 @@ export function App() { const data = useShoppingListData(listPath); return ( - - - }> - - - - } - /> - - - - } - /> - }> - - - } - /> - - - + + + + }> + + + + } + /> + + + + } + /> + }> + + + } + /> + + + + ); } diff --git a/src/components/IconButton.jsx b/src/components/IconButton.jsx index 9fd548b..29807c4 100644 --- a/src/components/IconButton.jsx +++ b/src/components/IconButton.jsx @@ -1,4 +1,4 @@ -import '../views/Layout.css'; +// import '../views/Layout.css'; export function IconButton({ as: Component = 'button', @@ -10,10 +10,10 @@ export function IconButton({ {...props} className={`flex items-center justify-center px-4 py-4 rounded-md shadow-md transition duration-200 ease-in-out ${props.className} - ${props.disabled ? 'bg-[#184E77] text-black cursor-not-allowed' : 'bg-[#184E77] text-white hover:bg-[#1E6091]'}`} + ${props.disabled ? 'bg-btnPrimary text-black cursor-not-allowed' : 'bg-btnPrimary text-white hover:bg-[#1E6091]'}`} disabled={props.disabled} > - {IconComponent && } + {IconComponent && } {props.label && {props.label}} ); diff --git a/src/components/ListItem.css b/src/components/ListItem.css deleted file mode 100644 index e42a39c..0000000 --- a/src/components/ListItem.css +++ /dev/null @@ -1,46 +0,0 @@ -.duesoon { - color: orange; - font-weight: bold; -} - -.duekindofsoon { - color: yellow; - font-weight: bold; -} - -.notduesoon { - color: green; - font-weight: bold; -} - -.nolongeractive { - color: gray; - font-weight: bold; -} - -.overdue { - color: red; - font-weight: bold; -} -.ListItem { - display: flex; - justify-content: space-between; - align-items: center; - padding: 10px 15px; - font-size: 16px; - margin-bottom: 10px; - border-radius: 8px; - transition: background-color 0.3s; -} - -.ListItem button { - border: none; - border-radius: 4px; - padding: 8px 12px; - cursor: pointer; -} - -.ListItem button:hover { - transform: scale(1.02); - box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2); -} diff --git a/src/components/ListItem.jsx b/src/components/ListItem.jsx index 380c14c..a31538e 100644 --- a/src/components/ListItem.jsx +++ b/src/components/ListItem.jsx @@ -2,7 +2,6 @@ import { useEffect, useState } from 'react'; import { useToggle } from '@uidotdev/usehooks'; import { Toggle } from './Toggle.jsx'; import { notify } from '../utils/notifications'; -import './ListItem.css'; import { updateItem, deleteItem } from '../api/firebase.js'; import { FaTrashAlt } from 'react-icons/fa'; import { IconButton } from './IconButton.jsx'; @@ -20,6 +19,17 @@ export function ListItem({ const [purchased, setPurchased] = useToggle(false); const [isDisabled, setIsDisabled] = useState(false); + // const formatDateLastPurchased = (dateLastPurchased) => { + // if (dateLastPurchased) { + // const date = dateLastPurchased.toDate(); + // const year = date.getFullYear(); + // const month = date.getMonth() + 1; + // const day = date.getDate(); + // return `${month}/${day}/${year}`; + // } + // return 'n/a'; + // }; + useEffect(() => { if (dateLastPurchased) { const checkExpiration = () => { @@ -79,29 +89,63 @@ export function ListItem({ } }; - const urgencyClass = sortCriteria.tag.toLowerCase().replace(/\s/g, ''); + const urgencyMap = { + 'Due soon': { + light: 'text-duesoon', + dark: 'dark:text-duesoondark', + }, + 'Due kind of soon': { + light: 'text-duekindofsoon', + dark: 'dark:text-duekindofsoondark', + }, + 'Not due soon': { + light: 'text-notduesoon', + dark: 'dark:text-notduesoondark', + }, + Overdue: { + light: 'text-overdue', + dark: 'dark:text-overduedark', + }, + 'No longer active': { + light: 'text-nolongeractive', + dark: 'dark:text-nolongeractivedark', + }, + }; + + const mode = localStorage.getItem('theme'); return ( <> -
- - {name} - -
{sortCriteria.tag}
+
+
+ +
+
+
+
{name}
+
- +
+
+ {sortCriteria.tag}{' '} +
+ +
+
); diff --git a/src/components/ModalDialog.jsx b/src/components/ModalDialog.jsx index cf6dda4..7c83411 100644 --- a/src/components/ModalDialog.jsx +++ b/src/components/ModalDialog.jsx @@ -24,12 +24,12 @@ export default function ModalDialog({ isOpen, onClose, children, title }) {
{title}
-

{children}

+

{children}

diff --git a/src/components/SingleList.css b/src/components/SingleList.css deleted file mode 100644 index 1e528f0..0000000 --- a/src/components/SingleList.css +++ /dev/null @@ -1,10 +0,0 @@ -.SingleList { - align-items: baseline; - display: flex; - flex-direction: row; - font-size: 1.2em; -} - -.SingleList-label { - margin-left: 0.2em; -} diff --git a/src/components/SingleList.jsx b/src/components/SingleList.jsx deleted file mode 100644 index 49d1885..0000000 --- a/src/components/SingleList.jsx +++ /dev/null @@ -1,13 +0,0 @@ -import './SingleList.css'; - -export function SingleList({ name, path, setListPath }) { - function handleClick() { - setListPath(path); - } - - return ( -
  • - -
  • - ); -} diff --git a/src/components/Toggle.css b/src/components/Toggle.css deleted file mode 100644 index f034b1b..0000000 --- a/src/components/Toggle.css +++ /dev/null @@ -1,19 +0,0 @@ -.Toggle { - margin-right: 10px; - display: flex; - align-items: center; -} - -.Toggle-checkbox { - accent-color: var(--color-accent); - margin-right: 10px; - cursor: pointer; -} - -.Toggle-label { - font-size: 1em; -} - -.Toggle-text { - margin-left: 5px; -} diff --git a/src/components/Toggle.jsx b/src/components/Toggle.jsx index bc63351..a1ee278 100644 --- a/src/components/Toggle.jsx +++ b/src/components/Toggle.jsx @@ -1,5 +1,4 @@ import { useState } from 'react'; -import './Toggle.css'; export function Toggle({ on, toggle, name, isDisabled }) { const [message, setMessage] = useState(''); @@ -23,20 +22,20 @@ export function Toggle({ on, toggle, name, isDisabled }) { } }; return ( -
    -