Skip to content

Commit

Permalink
Merge pull request #9 from coder-inbox/fix-app-theme
Browse files Browse the repository at this point in the history
fix in app theme
  • Loading branch information
wiseaidev committed Oct 2, 2023
2 parents 4e8263e + 5d9624d commit 3092a12
Show file tree
Hide file tree
Showing 21 changed files with 368 additions and 266 deletions.
2 changes: 1 addition & 1 deletion src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ const darkTheme = createTheme({
main: "#F50057",
},
background: {
paper: "#121212",
paper: "#222222",
default: "#080808",
},
text: {
Expand Down
47 changes: 34 additions & 13 deletions src/components/AppHeader/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
import { uploadPicture, userLogout } from "@app/store/authReducer/actions";
import { useTheme } from "@mui/material/styles";

import { toggleTheme } from "@app/store/authReducer";
import AppBar from "@mui/material/AppBar";
import Toolbar from "@mui/material/Toolbar";
import CustomElevator from "@app/components/Header/CustomElevator";
Expand Down Expand Up @@ -98,7 +99,7 @@ const AppHeader = ({ viewMode, handleViewModeChange }) => {
const toggleDarkTheme = () => {
const newTheme = darkTheme ? "light" : "dark";
setDarkTheme(newTheme === "dark");
localStorage.setItem("theme", newTheme);
dispatch(toggleTheme(newTheme));
};

const handleOpenNavMenu = (event) => {
Expand Down Expand Up @@ -152,10 +153,11 @@ const AppHeader = ({ viewMode, handleViewModeChange }) => {
return (
<Box
sx={{
borderBottom: `1px solid ${theme.palette.divider}`,
borderBottom: `1px solid ${theme.palette.text.primary}`,
display: "flex",
alignItems: "center",
padding: "10px 16px",
backgroundColor: theme.palette.background.default,
}}
>
<Box
Expand All @@ -168,7 +170,7 @@ const AppHeader = ({ viewMode, handleViewModeChange }) => {
}}
>
<IconButton onClick={(e) => handleViewModeChange(e.target.value)}>
<MenuIcon />
<MenuIcon sx={{ color: theme.palette.text.primary }} />
</IconButton>
<Box
component="img"
Expand Down Expand Up @@ -205,7 +207,7 @@ const AppHeader = ({ viewMode, handleViewModeChange }) => {
sx={{
position: "relative",
width: "100%",
backgroundColor: theme.palette.background.default,
color: theme.palette.text.primary,
}}
>
<InputBase
Expand All @@ -218,10 +220,8 @@ const AppHeader = ({ viewMode, handleViewModeChange }) => {
padding: "5px 15px 5px 35px",
height: "36px",
borderRadius: "4px",
border: `1px solid ${theme.palette.divider}`,
color: theme.palette.text.primary,
border: `1px solid ${theme.palette.text.primary}`,
fontSize: "12px",
backgroundColor: theme.palette.background.paper,
transition: "all 0.3s ease",
"&:focus": {
borderColor: theme.palette.text.primary,
Expand Down Expand Up @@ -249,7 +249,11 @@ const AppHeader = ({ viewMode, handleViewModeChange }) => {
}}
aria-label="Toggle theme"
>
{darkTheme ? <Brightness4Icon /> : <Brightness7Icon />}
{darkTheme ? (
<Brightness4Icon sx={{ color: theme.palette.text.primary }} />
) : (
<Brightness7Icon sx={{ color: theme.palette.text.primary }} />
)}
</IconButton>
<IconButton color="primary" onClick={handleRefreshClick}>
<RefreshIcon />
Expand Down Expand Up @@ -322,7 +326,14 @@ const AppHeader = ({ viewMode, handleViewModeChange }) => {
horizontal: "right",
}}
>
<Box p={{ xs: 2, md: 3 }}>
<Box
p={{
xs: 2,
md: 3,
color: theme.palette.text.primary,
backgroundColor: theme.palette.background.paper,
}}
>
<Box className="user-root">
<input {...getInputProps()} />
<IconButton className="icon-btn-root" {...getRootProps()}>
Expand All @@ -339,13 +350,23 @@ const AppHeader = ({ viewMode, handleViewModeChange }) => {
className="user-title"
component="h3"
variant="h6"
sx={{ color: "#fff" }}
sx={{
color: theme.palette.text.primary,
backgroundColor: theme.palette.background.paper,
}}
>
{currentAuthUser?.first_name
? currentAuthUser?.first_name
{currentAuthUser?.full_name
? currentAuthUser?.full_name
: ""}
</Typography>
<Typography className="user-sub-title" component="span">
<Typography
className="user-sub-title"
component="span"
sx={{
color: theme.palette.text.primary,
backgroundColor: theme.palette.background.paper,
}}
>
{currentAuthUser?.bio
? currentAuthUser?.bio.substring(0, 30) + "..."
: ""}
Expand Down
12 changes: 9 additions & 3 deletions src/components/ComposeMail/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ import DeleteIcon from "@mui/icons-material/Delete";
import LaunchIcon from "@mui/icons-material/Launch";
import SendIcon from "@mui/icons-material/Send";
import { composeMail } from "@app/store/mailAppReducer/actions";
import FilePicker from "../FilePicker";
import FilePicker from "@app/components/FilePicker";
import AppTextInput from "@app/components/AppTextInput";
import { isValidEmail } from "@app/components/Helper";
import CustomCard from "@app/components/CustomCard";
import CustomCardContent from "@app/components/CustomCardContent";
import CustomCardHeader from "@app/components/CustomCardHeader";
import EmojiPicker from "../MailDetail/EmojiPicker";
import EmojiPicker from "@app/components/MailDetail/EmojiPicker";
import { alpha, useTheme } from "@mui/material/styles";
import { useDispatch } from "react-redux";
const ComposeMail = ({
Expand Down Expand Up @@ -181,6 +181,7 @@ const ComposeMail = ({
height: "100%",
transition: "all 0.3s ease",
backgroundColor: theme.palette.popupColor.main,
borderRadius: 0,
boxShadow:
"0px 11px 15px -7px rgba(0,0,0,0.2),0px 24px 38px 3px rgba(0,0,0,0.14),0px 9px 46px 8px rgba(0,0,0,0.12)",
"&.card-minimise": {
Expand Down Expand Up @@ -438,7 +439,12 @@ const ComposeMail = ({
<Box>
<Tooltip title="Delete">
<IconButton onClick={onDiscardMail}>
<DeleteIcon />
<DeleteIcon
sx={{
color: theme.palette.text.primary,
backgroundColor: theme.palette.background.paper,
}}
/>
</IconButton>
</Tooltip>
</Box>
Expand Down
18 changes: 9 additions & 9 deletions src/components/CustomContentHead/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { isValidElement } from "react";
import PropTypes from "prop-types";
import CustomTitle from "@app/components/CustomTitle";
import CustomSubTitle from "@app/components/CustomSubTitle";
import { useTheme } from "@mui/material";
import { Box, useTheme } from "@mui/material";

function CustomContentHead({
icon,
Expand Down Expand Up @@ -33,19 +33,19 @@ function CustomContentHead({
};

return (
<div sx={headRootStyle} className="custom-content-head" {...restProps}>
<Box sx={headRootStyle} className="custom-content-head" {...restProps}>
{avatar && isValidElement(avatar) ? (
<div sx={avatarStyle} className="custom-avatar">
<Box sx={avatarStyle} className="custom-avatar">
{avatar}
</div>
</Box>
) : (
icon && (
<div sx={avatarStyle} className="custom-avatar">
<Box sx={avatarStyle} className="custom-avatar">
{icon}
</div>
</Box>
)
)}
<div sx={headerContentStyle} className="custom-header-content">
<Box sx={headerContentStyle} className="custom-header-content">
{title && (
<CustomTitle
sx={titleStyle}
Expand All @@ -62,8 +62,8 @@ function CustomContentHead({
{...subTitleProps}
/>
)}
</div>
</div>
</Box>
</Box>
);
}

Expand Down
8 changes: 4 additions & 4 deletions src/components/CustomDropdownMenu/index.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useEffect, useState } from "react";
import PropTypes from "prop-types";

import { Menu, MenuItem } from "@mui/material";
import { Box, Menu, MenuItem } from "@mui/material";

const DropdownMenu = ({ TriggerComponent, items, onItemClick }) => {
const [anchorEl, setAnchorEl] = useState(null);
Expand Down Expand Up @@ -29,10 +29,10 @@ const DropdownMenu = ({ TriggerComponent, items, onItemClick }) => {
};
return (
<>
<div className="pointer">
<Box className="pointer">
{/* eslint-disable-next-line*/}
<TriggerComponent.type {...TriggerComponent.props} onClick={openMenu} />
</div>
</Box>
<Menu
anchorEl={anchorEl}
keepMounted
Expand All @@ -51,7 +51,7 @@ const DropdownMenu = ({ TriggerComponent, items, onItemClick }) => {
}
>
{item.icon}
<div className="ml-2">{item.label}</div>
<Box className="ml-2">{item.label}</Box>
</MenuItem>
);
})}
Expand Down
10 changes: 5 additions & 5 deletions src/components/CustomList/ListFooter.jsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import React from "react";
import PropTypes from "prop-types";
import { CircularProgress, useTheme } from "@mui/material";
import { Box, CircularProgress, useTheme } from "@mui/material";

const ListFooter = ({ loading, footerText }) => {
const theme = useTheme();

return (
<div
<Box
sx={{
padding: "10px",
color: theme.palette.text.secondary,
Expand All @@ -15,7 +15,7 @@ const ListFooter = ({ loading, footerText }) => {
}}
>
{loading ? (
<div
<Box
sx={{
display: "flex",
padding: "8px",
Expand All @@ -26,11 +26,11 @@ const ListFooter = ({ loading, footerText }) => {
>
<CircularProgress size={16} />
<span sx={{ marginLeft: "8px" }}>Loading...</span>
</div>
</Box>
) : (
<p>{footerText}</p>
)}
</div>
</Box>
);
};

Expand Down
22 changes: 11 additions & 11 deletions src/components/CustomMedia/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const CustomMedia = ({
};

return (
<div sx={avatarClasses}>
<Box sx={avatarClasses}>
<Box mr={3} clone>
{isValidElement(avatar) ? (
avatar
Expand All @@ -47,7 +47,7 @@ const CustomMedia = ({
/>
)}
</Box>
</div>
</Box>
);
}
return null;
Expand All @@ -73,29 +73,29 @@ const CustomMedia = ({
return (
<Box sx={mediaObjectClasses} {...rest}>
{getAvatarComponent()}
<div sx={mediaImageClasses} onClick={onBodyClick}>
<div sx={mediaHeaderClasses}>
<div sx={{ className: "custom-media-header-content" }}>
<Box sx={mediaImageClasses} onClick={onBodyClick}>
<Box sx={mediaHeaderClasses}>
<Box sx={{ className: "custom-media-header-content" }}>
{title && <CustomTitle content={title} {...titleProps} />}
{subTitle && (
<CustomSubTitle content={subTitle} {...subTitleProps} />
)}
</div>
</Box>
{actionsComponent && (
<div className="custom-media-actions ml-3">{actionsComponent}</div>
<Box className="custom-media-actions ml-3">{actionsComponent}</Box>
)}
</div>
</Box>
{content && (
<div className="mb-3">
<Box className="mb-3">
{typeof content === "string" ? (
<Typography {...contentProps}>{content}</Typography>
) : (
content
)}
</div>
</Box>
)}
{children}
</div>
</Box>
{footerComponent && (
<Box
ml={3}
Expand Down
12 changes: 6 additions & 6 deletions src/components/CustomSummary/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const CustomSummary = ({

if (typeof badge !== "string") {
const node = (
<div
<Box
style={{
backgroundColor: "white",
boxShadow: "0 1px 3px 0 rgba(0, 0, 0, 0.15)",
Expand All @@ -39,7 +39,7 @@ const CustomSummary = ({
className="custom-badge"
>
{badge}
</div>
</Box>
);
badgeContent.badgeContent = node;
}
Expand All @@ -65,7 +65,7 @@ const CustomSummary = ({

const componentContent = () => {
return (
<div
<Box
style={{
display: "flex",
alignItems: "center",
Expand All @@ -75,7 +75,7 @@ const CustomSummary = ({
className={align}
>
{getAvatarComponent()}
<div
<Box
className="custom-user-info"
style={{
marginLeft: align === "horizontal" ? "15px" : "0",
Expand Down Expand Up @@ -104,8 +104,8 @@ const CustomSummary = ({
>
{subTitle}
</Box>
</div>
</div>
</Box>
</Box>
);
};

Expand Down
8 changes: 7 additions & 1 deletion src/components/EditInfo/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,13 @@ const EditInfo = ({ open, onCloseDialog }) => {
>
Edit Personal Information.
</DialogTitle>
<DialogContent dividers>
<DialogContent
dividers
sx={{
color: theme.palette.text.primary,
backgroundColor: theme.palette.background.paper,
}}
>
<Box component="form" onSubmit={onSubmit}>
<Box
display="flex"
Expand Down
Loading

0 comments on commit 3092a12

Please sign in to comment.