Skip to content
This repository has been archived by the owner on May 14, 2024. It is now read-only.

refactor theming #1002

Merged
merged 29 commits into from
Apr 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
d8911d8
refactor theming
abhinavkgrd Mar 29, 2023
b86f769
updated Palette colors
abhinavkgrd Mar 29, 2023
c5e635a
update theme refactoring
abhinavkgrd Mar 30, 2023
9cbb183
migrate components
abhinavkgrd Mar 30, 2023
886dd9c
fix issues
abhinavkgrd Mar 30, 2023
1498442
fix faintPressed color
abhinavkgrd Mar 31, 2023
bb64660
fix dialog shadow
abhinavkgrd Mar 31, 2023
e1a32de
extend TypeText with our custom properties
abhinavkgrd Mar 31, 2023
c6fe74c
migrated code using mui TextType colors
abhinavkgrd Mar 31, 2023
9afccc8
added complete custom TypeBackground
abhinavkgrd Mar 31, 2023
02ac9e2
migrated code using mui TypeBackground
abhinavkgrd Mar 31, 2023
c5bfe2a
Merge branch 'main' into theming-refactor
abhinavkgrd Apr 12, 2023
57ec409
removed unneeded theme type and updated to use new fill type
abhinavkgrd Apr 12, 2023
1f8db3b
fix shadows
abhinavkgrd Apr 12, 2023
af2b9f2
changed back to using box as base for chip
abhinavkgrd Apr 12, 2023
fe17038
fix translating to new property names
abhinavkgrd Apr 12, 2023
ef8b0a6
remove background color overrides as they are not used anywhere
abhinavkgrd Apr 12, 2023
e218cc1
updated to replace usage of palette.background to colors.background
abhinavkgrd Apr 12, 2023
83e8cb0
added muted black color
abhinavkgrd Apr 12, 2023
34c6c2a
fix badge style
abhinavkgrd Apr 12, 2023
7df731e
removed flash message unsed component
abhinavkgrd Apr 12, 2023
e2c6e80
revert alert theming changes...
abhinavkgrd Apr 12, 2023
ddeec27
fix issue
abhinavkgrd Apr 12, 2023
daf4eae
fix style
abhinavkgrd Apr 12, 2023
dc9a6b7
update to use TypographyProps instead of TypographyTypeMap
abhinavkgrd Apr 12, 2023
4836f05
fix type usage
abhinavkgrd Apr 12, 2023
44c4b56
rename theme state to themeColor state
abhinavkgrd Apr 12, 2023
034e9dc
make all custom added typography mapping as p
abhinavkgrd Apr 12, 2023
5c3851e
fix icon padding and refactor get icon color logic
abhinavkgrd Apr 12, 2023
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
2 changes: 1 addition & 1 deletion src/components/AuthenticateUserModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default function AuthenticateUserModal({
const somethingWentWrong = () =>
setDialogMessage({
title: t('ERROR'),
close: { variant: 'danger' },
close: { variant: 'critical' },
content: t('UNKNOWN_ERROR'),
});

Expand Down
15 changes: 8 additions & 7 deletions src/components/Badge.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { Paper, styled } from '@mui/material';
import { CSSProperties } from '@mui/styled-engine';
import { Box, styled } from '@mui/material';
import { CSSProperties } from '@mui/material/styles/createTypography';

export const Badge = styled(Paper)(({ theme }) => ({
export const Badge = styled(Box)(({ theme }) => ({
borderRadius: theme.shape.borderRadius,
padding: '2px 4px',
backgroundColor: theme.palette.backdrop.main,
backdropFilter: `blur(${theme.palette.blur.muted})`,
color: theme.palette.primary.contrastText,
backgroundColor: theme.colors.black.muted,
backdropFilter: `blur(${theme.colors.blur.muted})`,
color: theme.colors.white.base,
textTransform: 'uppercase',
...(theme.typography.mini as CSSProperties),
...(theme.typography.tiny as CSSProperties),
}));
4 changes: 2 additions & 2 deletions src/components/ChangeEmail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,14 @@ function ChangeEmailForm() {
<>
{showMessage && (
<Alert
color="accent"
color="success"
onClose={() => setShowMessage(false)}>
<Trans
i18nKey="EMAIL_SENT"
components={{
a: (
<Box
color="text.secondary"
color="text.muted"
component={'span'}
/>
),
Expand Down
4 changes: 2 additions & 2 deletions src/components/CheckboxInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ import {
Checkbox,
FormGroup,
Typography,
TypographyTypeMap,
TypographyProps,
} from '@mui/material';

interface Iprops {
disabled?: boolean;
checked: boolean;
onChange: (value: boolean) => void;
label: string;
labelProps?: TypographyTypeMap['props'];
labelProps?: TypographyProps;
}
export function CheckboxInput({
disabled,
Expand Down
5 changes: 3 additions & 2 deletions src/components/Chip.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { Box, styled } from '@mui/material';
import { CSSProperties } from '@mui/material/styles/createTypography';

export const Chip = styled(Box)(({ theme }) => ({
...theme.typography.body2,
...(theme.typography.small as CSSProperties),
padding: '8px 12px',
borderRadius: '4px',
backgroundColor: theme.palette.fill.dark,
backgroundColor: theme.colors.fill.faint,
fontWeight: 'bold',
}));
2 changes: 1 addition & 1 deletion src/components/CodeBlock/styledComponents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { CenteredFlex } from 'components/Container';
import { Box, styled } from '@mui/material';
export const Wrapper = styled(CenteredFlex)`
position: relative;
background: ${({ theme }) => theme.palette.accent.dark};
background: ${({ theme }) => theme.colors.accent.A700};
border-radius: ${({ theme }) => theme.shape.borderRadius}px;
min-height: 80px;
`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ export default function CollectionSort(props: CollectionSortProps) {
sx: {
backgroundColor: (theme) =>
props.nestedInDialog &&
theme.palette.background.overPaper,
theme.colors.background.elevated2,
},
}}
triggerButtonProps={{
sx: {
background: (theme) =>
!props.disableBG && theme.palette.fill.dark,
!props.disableBG && theme.colors.fill.faint,
},
}}>
<CollectionSortOptions {...props} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default function AllCollectionCard({
onClick={() => onCollectionClick(collectionSummary.id)}>
<AllCollectionTileText>
<Typography>{collectionSummary.name}</Typography>
<Typography variant="body2" color="text.secondary">
<Typography variant="small" color="text.muted">
{t('photos_count', { count: collectionSummary.fileCount })}
</Typography>
</AllCollectionTileText>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Collections/AllCollections/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default function AllCollectionsHeader({
<FluidContainer mr={1.5}>
<Box>
<Typography variant="h3">{t('ALL_ALBUMS')}</Typography>
<Typography variant="body2" color={'text.secondary'}>
<Typography variant="small" color={'text.muted'}>
{t('albums', { count: collectionCount })}
</Typography>
</Box>
Expand Down
4 changes: 2 additions & 2 deletions src/components/Collections/CollectionInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ export function CollectionInfo({ name, fileCount, endIcon }: Iprops) {
<Typography variant="h3">{name}</Typography>

<FlexWrapper>
<Typography variant="body2" color="text.secondary">
<Typography variant="small" color="text.muted">
{t('photos_count', { count: fileCount })}
</Typography>
{endIcon && (
<Box
sx={{
svg: {
fontSize: '17px',
color: 'text.secondary',
color: 'text.muted',
},
}}
ml={1.5}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ function CollectionCardIcon({ collectionType }) {
{collectionType === CollectionSummaryType.archived && (
<ArchiveIcon
sx={(theme) => ({
color: theme.palette.fixed.strokeMutedWhite,
color: theme.colors.white.muted,
})}
/>
)}
Expand Down
4 changes: 2 additions & 2 deletions src/components/Collections/CollectionListBar/ScrollButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ const Wrapper = styled('button')<{ direction: SCROLL_DIRECTION }>`
margin: 0;

border-radius: 50%;
background-color: ${({ theme }) => theme.palette.background.paper};
color: ${({ theme }) => theme.palette.primary.main};
background-color: ${({ theme }) => theme.colors.backdrop.muted};
color: ${({ theme }) => theme.colors.stroke.base};

${(props) =>
props.direction === SCROLL_DIRECTION.LEFT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ interface Iprops {
export function TrashCollectionOption({ handleCollectionAction }: Iprops) {
return (
<OverflowMenuOption
color="danger"
color="critical"
startIcon={<DeleteOutlinedIcon />}
onClick={handleCollectionAction(
CollectionActions.CONFIRM_EMPTY_TRASH,
Expand Down
10 changes: 5 additions & 5 deletions src/components/Collections/CollectionOptions/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ const CollectionOptions = (props: CollectionOptionsProps) => {
setDialogMessage({
title: t('ERROR'),
content: t('UNKNOWN_ERROR'),
close: { variant: 'danger' },
close: { variant: 'critical' },
});
} finally {
syncWithRemote(false, true);
Expand Down Expand Up @@ -192,7 +192,7 @@ const CollectionOptions = (props: CollectionOptionsProps) => {
<Trans
i18nKey={'DELETE_COLLECTION_MESSAGE'}
components={{
a: <Box component={'span'} color="text.primary" />,
a: <Box component={'span'} color="text.base" />,
}}
/>
),
Expand All @@ -201,7 +201,7 @@ const CollectionOptions = (props: CollectionOptionsProps) => {
action: handleCollectionAction(
CollectionActions.DELETE_WITH_FILES
),
variant: 'danger',
variant: 'critical',
},
secondary: {
text: t('KEEP_PHOTOS'),
Expand Down Expand Up @@ -239,7 +239,7 @@ const CollectionOptions = (props: CollectionOptionsProps) => {
proceed: {
action: handleCollectionAction(CollectionActions.EMPTY_TRASH),
text: t('EMPTY_TRASH'),
variant: 'danger',
variant: 'critical',
},
close: { text: t('CANCEL') },
});
Expand All @@ -253,7 +253,7 @@ const CollectionOptions = (props: CollectionOptionsProps) => {
action: handleCollectionAction(
CollectionActions.LEAVE_SHARED_ALBUM
),
variant: 'danger',
variant: 'critical',
},
close: {
text: t('CANCEL'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ export default function EnablePublicShareOptions({
{sharableLinkError && (
<Typography
textAlign={'center'}
variant="body2"
variant="small"
sx={{
color: (theme) => theme.palette.danger.main,
color: (theme) => theme.colors.caution.A500,
mt: 0.5,
}}>
{sharableLinkError}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export function ManageDownloadAccess({
collectionID: collection.id,
enableDownload: false,
}),
variant: 'danger',
variant: 'critical',
},
});
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ export default function ManagePublicShareOptions({
{t('COPY_LINK')}
</EnteMenuItem>
<EnteMenuItem
color="danger"
color="critical"
startIcon={<RemoveCircleOutline />}
onClick={disablePublicSharing}>
{t('REMOVE_LINK')}
Expand All @@ -148,9 +148,9 @@ export default function ManagePublicShareOptions({
{sharableLinkError && (
<Typography
textAlign={'center'}
variant="body2"
variant="small"
sx={{
color: (theme) => theme.palette.danger.main,
color: (theme) => theme.colors.caution.A500,
mt: 0.5,
}}>
{sharableLinkError}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export function ManageLinkPassword({
collectionID: collection.id,
disablePassword: true,
}),
variant: 'danger',
variant: 'critical',
},
});
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export default function ManagePublicShare({
return (
<>
<Stack>
<Typography color="text.secondary" variant="body2" padding={1}>
<Typography color="text.muted" variant="small" padding={1}>
<PublicIcon style={{ fontSize: 17, marginRight: 8 }} />
{t('PUBLIC_LINK_ENABLED')}
</Typography>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export function CollectionShareSharees({ collection }: Iprops) {

return (
<Box mb={3}>
<Typography variant="body2" color="text.secondary">
<Typography variant="small" color="text.muted">
{t('SHAREES')}
</Typography>
{collection.sharees?.map((sharee) => (
Expand Down
4 changes: 2 additions & 2 deletions src/components/Collections/CollectionShare/sharees/row.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ const ShareeRow = ({ sharee, collectionUnshare }: IProps) => {
menuPaperProps={{
sx: {
backgroundColor: (theme) =>
theme.palette.background.overPaper,
theme.colors.background.elevated2,
},
}}
ariaControls={`email-share-${sharee.email}`}
triggerButtonIcon={<MoreHorizIcon />}>
<OverflowMenuOption
color="danger"
color="critical"
onClick={handleClick}
startIcon={<NotInterestedIcon />}>
{t('REMOVE')}
Expand Down
2 changes: 1 addition & 1 deletion src/components/Container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export const Overlay = styled(Box)`
`;

export const IconButtonWithBG = styled(IconButton)(({ theme }) => ({
backgroundColor: theme.palette.fill.dark,
backgroundColor: theme.colors.fill.faint,
}));

export const HorizontalFlex = styled(Box)({
Expand Down
12 changes: 6 additions & 6 deletions src/components/DeleteAccountModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const DeleteAccountModal = ({ open, onClose }: Iprops) => {
const somethingWentWrong = () =>
setDialogBoxAttributesV2({
title: t('ERROR'),
close: { variant: 'danger' },
close: { variant: 'critical' },
content: t('UNKNOWN_ERROR'),
});

Expand Down Expand Up @@ -113,7 +113,7 @@ const DeleteAccountModal = ({ open, onClose }: Iprops) => {
proceed: {
text: t('DELETE'),
action: solveChallengeAndDeleteAccount,
variant: 'danger',
variant: 'critical',
},
close: { text: t('CANCEL') },
});
Expand All @@ -136,7 +136,7 @@ const DeleteAccountModal = ({ open, onClose }: Iprops) => {
action: () => {
initiateEmail('account-deletion@ente.io');
},
variant: 'danger',
variant: 'critical',
},
close: { text: t('CANCEL') },
});
Expand Down Expand Up @@ -202,7 +202,7 @@ const DeleteAccountModal = ({ open, onClose }: Iprops) => {
)}
selected={values.reason}
setSelected={handleChange('reason')}
messageProps={{ color: 'danger.main' }}
messageProps={{ color: 'critical.main' }}
message={errors.reason}
/>
<MultilineInput
Expand All @@ -213,7 +213,7 @@ const DeleteAccountModal = ({ open, onClose }: Iprops) => {
value={values.feedback}
onChange={handleChange('feedback')}
message={errors.feedback}
messageProps={{ color: 'danger.main' }}
messageProps={{ color: 'critical.main' }}
rowCount={3}
/>
<CheckboxInput
Expand All @@ -227,7 +227,7 @@ const DeleteAccountModal = ({ open, onClose }: Iprops) => {
<EnteButton
type="submit"
size="large"
color="danger"
color="critical"
disabled={!acceptDataDeletion}
loading={loading}>
{t('CONFIRM_DELETE_ACCOUNT')}
Expand Down
2 changes: 1 addition & 1 deletion src/components/DialogBox/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export default function DialogBox({
{(children || attributes?.content) && (
<DialogContent>
{children || (
<Typography color="text.secondary">
<Typography color="text.muted">
{attributes.content}
</Typography>
)}
Expand Down
4 changes: 2 additions & 2 deletions src/components/DialogBoxV2/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ export default function DialogBoxV2({
</Box>
)}
{attributes.title && (
<Typography variant="h4" fontWeight={'bold'}>
<Typography variant="large" fontWeight={'bold'}>
{attributes.title}
</Typography>
)}
{children ||
(attributes?.content && (
<Typography color="text.secondary">
<Typography color="text.muted">
{attributes.content}
</Typography>
))}
Expand Down
Loading