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

Improving the mobile css #180

Merged
merged 10 commits into from
Sep 29, 2024
6 changes: 4 additions & 2 deletions ui/src/common/DateTimeSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,24 @@ interface DateTimeSelectorProps {
showDate: boolean;
jmattheis marked this conversation as resolved.
Show resolved Hide resolved
label: string;
popoverOpen?: (open: boolean) => void;
style?: object;
Minnowo marked this conversation as resolved.
Show resolved Hide resolved
}
Minnowo marked this conversation as resolved.
Show resolved Hide resolved

export const DateTimeSelector: React.FC<DateTimeSelectorProps> = React.memo(
({selectedDate, onSelectDate, showDate, label, popoverOpen = () => {}}) => {
({selectedDate, onSelectDate, showDate, label, popoverOpen = () => {}, style = null}) => {
const [open, setOpen] = React.useState(false);
const localeData = moment.localeData();
const time = localeData.longDateFormat('LT').replace('A', 'a');
const ampm = time.indexOf('a') !== -1;
const format = showDate ? localeData.longDateFormat('L') + ' ' + time : time;
const width = (showDate ? 185 : 105) + (ampm ? 20 : 0);

return (
<KeyboardDateTimePicker
variant="inline"
InputProps={{disableUnderline: true}}
title={selectedDate.format()}
style={{width: (showDate ? 185 : 95) + (ampm ? 20 : 0)}}
style={{minWidth: width, maxWidth: width, ...style}}
Minnowo marked this conversation as resolved.
Show resolved Hide resolved
PopoverProps={{
onEntered: () => {
popoverOpen(true);
Expand Down
11 changes: 10 additions & 1 deletion ui/src/common/TagChip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,16 @@ export const TagChip = ({color, label}: {label: string; color: string}) => {
<Chip
tabIndex={-1}
variant="outlined"
style={{background: color, margin: '5px', color: textColor, cursor: 'text'}}
style={{
background: color,
margin: '5px',
color: textColor,
cursor: 'text',
minHeight: '32px',
height: 'auto',
Minnowo marked this conversation as resolved.
Show resolved Hide resolved
whiteSpace: 'normal',
wordBreak: 'break-word',
}}
label={label}
/>
);
Expand Down
1 change: 0 additions & 1 deletion ui/src/dashboard/DashboardsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ const useStyles = makeStyles((theme) => ({
paddingBottom: theme.spacing(3),
textAlign: 'center',
maxWidth: 800,
minWidth: 500,
margin: '0 auto',
},
}));
Expand Down
1 change: 0 additions & 1 deletion ui/src/devices/DevicesPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ const useStyles = makeStyles((theme) => ({
paddingBottom: theme.spacing(3),
textAlign: 'center',
maxWidth: 1200,
minWidth: 800,
margin: '0 auto',
},
}));
Expand Down
5 changes: 5 additions & 0 deletions ui/src/global.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,8 @@ body,
html {
height: 100%;
}

/* Allows the tag Chips to wrap lines */
.MuiChip-label {
white-space: normal !important;
}
1 change: 0 additions & 1 deletion ui/src/setting/SettingsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ const useStyles = makeStyles((theme) => ({
paddingTop: theme.spacing(1),
paddingBottom: theme.spacing(3),
maxWidth: 500,
minWidth: 500,
margin: '0 auto',
},
}));
Expand Down
1 change: 0 additions & 1 deletion ui/src/tag/TagPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ const useStyles = makeStyles((theme) => ({
paddingBottom: theme.spacing(3),
textAlign: 'center',
maxWidth: 1200,
minWidth: 800,
margin: '0 auto',
},
}));
Expand Down
4 changes: 2 additions & 2 deletions ui/src/tag/TagSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ export const TagSelector: React.FC<TagSelectorProps> = ({

return (
<ClickAwayListener onClickAway={() => setOpen(false)}>
<div>
<div style={{width: '100%'}}>
<Tooltip
disableFocusListener
disableHoverListener
Expand All @@ -153,7 +153,7 @@ export const TagSelector: React.FC<TagSelectorProps> = ({
}>
<div
ref={(ref) => (container.current = ref)}
style={{display: 'flex', flexWrap: 'wrap', cursor: 'text'}}
style={{display: 'flex', flexWrap: 'wrap', cursor: 'text', width: '100%'}}
onClick={focusInput}>
{toChips(selectedEntries)}
<Input
Expand Down
Loading
Loading