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

🎨 Update theme #666

Merged
merged 2 commits into from
Mar 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 1 addition & 7 deletions frontend/src/components/Admin/AddUser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -174,13 +174,7 @@ const AddUser: React.FC<AddUserProps> = ({ isOpen, onClose }) => {
</Flex>
</ModalBody>
<ModalFooter gap={3}>
<Button
bg="ui.main"
color="white"
_hover={{ opacity: 0.8 }}
type="submit"
isLoading={isSubmitting}
>
<Button variant="primary" type="submit" isLoading={isSubmitting}>
Save
</Button>
<Button onClick={onClose}>Cancel</Button>
Expand Down
4 changes: 1 addition & 3 deletions frontend/src/components/Admin/EditUser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,7 @@ const EditUser: React.FC<EditUserProps> = ({ user, isOpen, onClose }) => {

<ModalFooter gap={3}>
<Button
bg="ui.main"
color="white"
_hover={{ opacity: 0.8 }}
variant="primary"
type="submit"
isLoading={isSubmitting}
isDisabled={!isDirty}
Expand Down
8 changes: 1 addition & 7 deletions frontend/src/components/Common/DeleteAlert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,7 @@ const Delete: React.FC<DeleteProps> = ({ type, id, isOpen, onClose }) => {
</AlertDialogBody>

<AlertDialogFooter gap={3}>
<Button
bg="ui.danger"
color="white"
_hover={{ opacity: 0.8 }}
type="submit"
isLoading={isSubmitting}
>
<Button variant="danger" type="submit" isLoading={isSubmitting}>
Delete
</Button>
<Button
Expand Down
4 changes: 1 addition & 3 deletions frontend/src/components/Common/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ const Navbar: React.FC<NavbarProps> = ({ type }) => {
<Input type='text' placeholder='Search' fontSize={{ base: 'sm', md: 'inherit' }} borderRadius='8px' />
</InputGroup> */}
<Button
bg="ui.main"
color="white"
_hover={{ opacity: 0.8 }}
variant="primary"
gap={1}
fontSize={{ base: 'sm', md: 'inherit' }}
onClick={type === 'User' ? addUserModal.onOpen : addItemModal.onOpen}
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/components/Common/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ import SidebarItems from './SidebarItems'

const Sidebar: React.FC = () => {
const queryClient = useQueryClient()
const bgColor = useColorModeValue('white', '#1a202c')
const textColor = useColorModeValue('gray', 'white')
const secBgColor = useColorModeValue('ui.secondary', '#252d3d')
const bgColor = useColorModeValue('ui.white', 'ui.dark')
const textColor = useColorModeValue('ui.light', 'ui.white')
const secBgColor = useColorModeValue('ui.secondary', 'ui.darkSlate')
const currentUser = queryClient.getQueryData<UserOut>('currentUser')
const { isOpen, onOpen, onClose } = useDisclosure()
const { logout } = useAuth()
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/Common/SidebarItems.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ interface SidebarItemsProps {

const SidebarItems: React.FC<SidebarItemsProps> = ({ onClose }) => {
const queryClient = useQueryClient()
const textColor = useColorModeValue('ui.main', '#E2E8F0')
const textColor = useColorModeValue('ui.main', 'ui.light')
const bgActive = useColorModeValue('#E2E8F0', '#4A5568')
const currentUser = queryClient.getQueryData<UserOut>('currentUser')

Expand Down
8 changes: 1 addition & 7 deletions frontend/src/components/Items/AddItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,7 @@ const AddItem: React.FC<AddItemProps> = ({ isOpen, onClose }) => {
</ModalBody>

<ModalFooter gap={3}>
<Button
bg="ui.main"
color="white"
_hover={{ opacity: 0.8 }}
type="submit"
isLoading={isSubmitting}
>
<Button variant="primary" type="submit" isLoading={isSubmitting}>
Save
</Button>
<Button onClick={onClose}>Cancel</Button>
Expand Down
4 changes: 1 addition & 3 deletions frontend/src/components/Items/EditItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,7 @@ const EditItem: React.FC<EditItemProps> = ({ item, isOpen, onClose }) => {
</ModalBody>
<ModalFooter gap={3}>
<Button
bg="ui.main"
color="white"
_hover={{ opacity: 0.8 }}
variant="primary"
type="submit"
isLoading={isSubmitting}
isDisabled={!isDirty}
Expand Down
6 changes: 2 additions & 4 deletions frontend/src/components/UserSettings/ChangePassword.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ interface UpdatePasswordForm extends UpdatePassword {
}

const ChangePassword: React.FC = () => {
const color = useColorModeValue('gray.700', 'white')
const color = useColorModeValue('inherit', 'ui.white')
const showToast = useCustomToast()
const {
register,
Expand Down Expand Up @@ -114,9 +114,7 @@ const ChangePassword: React.FC = () => {
)}
</FormControl>
<Button
bg="ui.main"
color="white"
_hover={{ opacity: 0.8 }}
variant="primary"
mt={4}
type="submit"
isLoading={isSubmitting}
Expand Down
8 changes: 1 addition & 7 deletions frontend/src/components/UserSettings/DeleteConfirmation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,7 @@ const DeleteConfirmation: React.FC<DeleteProps> = ({ isOpen, onClose }) => {
</AlertDialogBody>

<AlertDialogFooter gap={3}>
<Button
bg="ui.danger"
color="white"
_hover={{ opacity: 0.8 }}
type="submit"
isLoading={isSubmitting}
>
<Button variant="danger" type="submit" isLoading={isSubmitting}>
Confirm
</Button>
<Button
Expand Down
8 changes: 3 additions & 5 deletions frontend/src/components/UserSettings/UserInformation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import useCustomToast from '../../hooks/useCustomToast'

const UserInformation: React.FC = () => {
const queryClient = useQueryClient()
const color = useColorModeValue('gray.700', 'white')
const color = useColorModeValue('inherit', 'ui.white')
const showToast = useCustomToast()
const [editMode, setEditMode] = useState(false)
const { user: currentUser } = useAuth()
Expand Down Expand Up @@ -109,7 +109,7 @@ const UserInformation: React.FC = () => {
message: 'Invalid email address',
},
})}
type="text"
type="email"
size="md"
/>
) : (
Expand All @@ -123,9 +123,7 @@ const UserInformation: React.FC = () => {
</FormControl>
<Flex mt={4} gap={3}>
<Button
bg="ui.main"
color="white"
_hover={{ opacity: 0.8 }}
variant="primary"
onClick={toggleEditMode}
type={editMode ? 'button' : 'submit'}
isLoading={editMode ? isSubmitting : false}
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/routes/_layout/admin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ function Admin() {
<Tbody>
{users.data.map((user) => (
<Tr key={user.id}>
<Td color={!user.full_name ? 'gray.600' : 'inherit'}>
<Td color={!user.full_name ? 'gray.400' : 'inherit'}>
{user.full_name || 'N/A'}
{currentUser?.id === user.id && (
<Badge ml="1" colorScheme="teal">
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/routes/_layout/items.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ function Items() {
<Tr key={item.id}>
<Td>{item.id}</Td>
<Td>{item.title}</Td>
<Td color={!item.description ? 'gray.600' : 'inherit'}>
<Td color={!item.description ? 'gray.400' : 'inherit'}>
{item.description || 'N/A'}
</Td>
<Td>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/routes/login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ function Login() {
},
})}
placeholder="Email"
type="text"
type="email"
/>
{errors.username && (
<FormErrorMessage>{errors.username.message}</FormErrorMessage>
Expand Down
34 changes: 34 additions & 0 deletions frontend/src/theme.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,49 @@
import { extendTheme } from '@chakra-ui/react'

const disabledStyles = {
_disabled: {
backgroundColor: 'ui.main',
},
}

const theme = extendTheme({
colors: {
ui: {
main: '#009688',
secondary: '#EDF2F7',
success: '#48BB78',
danger: '#E53E3E',
light: '#E2E8F0',
dark: '#1A202C',
white: '#FFFFFF',
darkSlate: '#252D3D',
},
},
components: {
Button: {
variants: {
primary: {
backgroundColor: 'ui.main',
color: 'ui.white',
_hover: {
backgroundColor: '#00766C',
},
_disabled: {
...disabledStyles,
_hover: {
...disabledStyles,
},
},
},
danger: {
backgroundColor: 'ui.danger',
color: 'ui.white',
_hover: {
backgroundColor: '#E32727',
},
},
},
},
Tabs: {
variants: {
enclosed: {
Expand Down
Loading