Skip to content

Commit

Permalink
style: 🐛 Some UI fixes for iOS PWA
Browse files Browse the repository at this point in the history
  • Loading branch information
Genio2003 committed Jan 29, 2024
1 parent 5642e99 commit f5270c5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
7 changes: 7 additions & 0 deletions src/globalStyles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,13 @@ export const useGlobalStyles = makeStyles({
alignItems: "flex-start",
},
},
// Truncate overflowing text with "..." and hide the overflow
ellipsisText: {
display: "block",
overflowX: "hidden",
whiteSpace: "nowrap",
textOverflow: "ellipsis",
},
ongoing: {
backgroundColor: tokens.colorPaletteLightGreenBackground2,
},
Expand Down
21 changes: 11 additions & 10 deletions src/routes/Calendar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { EventDto } from "../dto/EventDto";
import { generateMonth, generateShortWeek, generateWeek } from "../libraries/calendarGenerator/calendarGenerator";
import { useMediaQuery } from "../libraries/mediaQuery/mediaQuery";
import useRequests from "../libraries/requests/requests";
import { useGlobalStyles } from "../globalStyles";

const useStyles = makeStyles({
drawerBody: {
Expand All @@ -28,6 +29,12 @@ const useStyles = makeStyles({
drawer: {
...shorthands.borderRadius(tokens.borderRadiusMedium),
},
mobileMargins: {
marginTop: "2.5rem",
marginBottom: "1rem",
marginRight: "1rem",
marginLeft: "1rem",
},
container: {
display: "flex",
flexDirection: "column",
Expand Down Expand Up @@ -138,13 +145,6 @@ const useStyles = makeStyles({
...shorthands.margin("0"),
backgroundColor: tokens.colorBrandBackground2Hover,
},
// Truncate overflowing text with "..." and hide the overflow
ellipsisText: {
display: "block",
overflowX: "hidden",
whiteSpace: "nowrap",
textOverflow: "ellipsis",
},
wide: {
alignSelf: "stretch",
},
Expand Down Expand Up @@ -210,6 +210,7 @@ const RANDOMABLE_COLORS = [...Array(COLORS.length - 1).keys()].map(k => k + 1);

export function Calendar() {
const styles = useStyles();
const globalStyles = useGlobalStyles();
const { course } = useContext(UserContext).course;
const screenMediaQuery = useMediaQuery("(max-width: 578px)");
const requests = useRequests();
Expand Down Expand Up @@ -464,7 +465,7 @@ export function Calendar() {
className={styles.event}
style={{ backgroundColor: getColorValue(event.color) }}
>
<Caption1 className={isCurrentViewMonth ? styles.ellipsisText : undefined}>{event.subject}</Caption1>
<Caption1 className={isCurrentViewMonth ? globalStyles.ellipsisText : undefined}>{event.subject}</Caption1>

{/* Week view style */}
<div style={isCurrentViewMonth ? { display: "none" } : undefined}>
Expand All @@ -491,7 +492,7 @@ export function Calendar() {

return (
<div className={styles.dialogCalendarView} key={calendar.selection.id}>
<Subtitle2 className={styles.ellipsisText}>{calendar.selection.fullName}</Subtitle2>
<Subtitle2 className={globalStyles.ellipsisText}>{calendar.selection.fullName}</Subtitle2>
<div className={styles.dialogEventList}>
{
// Foreach event in the current calendar render the detailed preview card
Expand Down Expand Up @@ -698,7 +699,7 @@ export function Calendar() {
}, [dateTime, calendars]);

return (
<div className={mergeClasses(styles.container, styles.sideMargin)}>
<div className={ screenMediaQuery ? mergeClasses(styles.container, styles.mobileMargins) : mergeClasses(styles.container, styles.sideMargin)}>
<Card className={styles.toolbar}>
<DateSelector autoUpdate={true} dateTime={dateTime} setDateTime={setDateTime} inputType={isCurrentViewMonth ? "month" : screenMediaQuery ? "shortWeek" : "week"} />
<div className={styles.stack}>
Expand Down

0 comments on commit f5270c5

Please sign in to comment.