fix: mobile styles + viewport
This commit is contained in:
parent
e0843fc89a
commit
cf3b79d4aa
|
|
@ -1,3 +1,4 @@
|
|||
import { Box, MediaQuery } from '@mantine/core';
|
||||
import React, { useState, useEffect } from 'react';
|
||||
|
||||
export interface Props {
|
||||
|
|
@ -33,8 +34,8 @@ const TimeElapsed = ({ startTime, endTime }: Props) => {
|
|||
.padStart(2, '0')}`;
|
||||
|
||||
return (
|
||||
<div
|
||||
style={{
|
||||
<Box
|
||||
sx={{
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
|
|
@ -50,6 +51,12 @@ const TimeElapsed = ({ startTime, endTime }: Props) => {
|
|||
>
|
||||
<code>{hoursString}</code>
|
||||
</pre>
|
||||
<MediaQuery
|
||||
smallerThan="sm"
|
||||
styles={{
|
||||
display: 'none'
|
||||
}}
|
||||
>
|
||||
<p
|
||||
style={{
|
||||
fontSize: '0.75rem',
|
||||
|
|
@ -74,7 +81,8 @@ const TimeElapsed = ({ startTime, endTime }: Props) => {
|
|||
: 'now'}
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
</MediaQuery>
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
|
||||
|
|
|
|||
15
app/root.tsx
15
app/root.tsx
|
|
@ -126,6 +126,17 @@ function Document({
|
|||
<html lang="en">
|
||||
<head>
|
||||
<meta charSet="utf-8" />
|
||||
<meta
|
||||
name="viewport"
|
||||
content="minimum-scale=1, initial-scale=1, width=device-width, shrink-to-fit=no, user-scalable=no, viewport-fit=cover"
|
||||
/>
|
||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||
<meta
|
||||
name="apple-mobile-web-app-status-bar-style"
|
||||
content="default"
|
||||
/>
|
||||
<meta name="format-detection" content="telephone=no" />
|
||||
<meta name="mobile-web-app-capable" content="yes" />
|
||||
{title ? <title>{title}</title> : null}
|
||||
<StylesPlaceholder />
|
||||
<Meta />
|
||||
|
|
@ -355,7 +366,7 @@ function Layout({ children }: React.PropsWithChildren<{}>) {
|
|||
</UnstyledButton>
|
||||
<UnstyledButton
|
||||
component={Link}
|
||||
to="/"
|
||||
to="/importexport"
|
||||
sx={(theme) => ({
|
||||
display: 'block',
|
||||
width: '100%',
|
||||
|
|
@ -379,7 +390,7 @@ function Layout({ children }: React.PropsWithChildren<{}>) {
|
|||
<Upload size={16} />
|
||||
</ThemeIcon>
|
||||
|
||||
<Text size="sm">Import</Text>
|
||||
<Text size="sm">Import/Export</Text>
|
||||
</Group>
|
||||
</UnstyledButton>
|
||||
<UnstyledButton
|
||||
|
|
|
|||
|
|
@ -14,7 +14,8 @@ import {
|
|||
Progress,
|
||||
Badge,
|
||||
ThemeIcon,
|
||||
Alert
|
||||
Alert,
|
||||
Box
|
||||
} from '@mantine/core';
|
||||
import { json, LoaderArgs, MetaFunction, redirect } from '@remix-run/node';
|
||||
import {
|
||||
|
|
@ -138,7 +139,8 @@ export default function TimeEntriesPage() {
|
|||
style={{
|
||||
display: 'flex',
|
||||
alignItems: 'flex-end',
|
||||
justifyContent: 'space-between'
|
||||
justifyContent: 'space-between',
|
||||
margin: '0.5rem 0'
|
||||
}}
|
||||
>
|
||||
<NativeSelect
|
||||
|
|
@ -248,38 +250,83 @@ export default function TimeEntriesPage() {
|
|||
radius="md"
|
||||
mb="sm"
|
||||
display="flex"
|
||||
style={{
|
||||
alignItems: 'center',
|
||||
flexDirection: 'column'
|
||||
}}
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
display: 'flex',
|
||||
sx={() => ({
|
||||
alignItems: 'center',
|
||||
justifyContent: 'space-between',
|
||||
width: '100%'
|
||||
}}
|
||||
flexDirection: 'row'
|
||||
})}
|
||||
>
|
||||
<span
|
||||
style={{
|
||||
marginRight: 'auto'
|
||||
<Box
|
||||
sx={() => ({
|
||||
display: 'flex',
|
||||
alignItems: 'flex-start',
|
||||
flexDirection: 'column',
|
||||
justifyContent: 'space-between',
|
||||
flexGrow: 1,
|
||||
width: '100%',
|
||||
|
||||
'@media (min-width: 601px)': {
|
||||
alignItems: 'center',
|
||||
flexDirection: 'row'
|
||||
}
|
||||
})}
|
||||
>
|
||||
<Box
|
||||
component="span"
|
||||
sx={{
|
||||
display: 'inline-block',
|
||||
marginRight: 'auto',
|
||||
|
||||
'@media (max-width: 600px)': {
|
||||
marginBottom: '0.33rem'
|
||||
}
|
||||
}}
|
||||
>
|
||||
{timeEntry.description}
|
||||
</span>
|
||||
</Box>
|
||||
{timeEntry.projectId && timeEntry.project && (
|
||||
<Badge color={timeEntry.project.color}>
|
||||
{timeEntry.project.name}
|
||||
</Badge>
|
||||
)}
|
||||
</Box>
|
||||
<Box
|
||||
sx={{
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
flexDirection: 'column',
|
||||
justifyContent: 'space-between',
|
||||
flexShrink: 1,
|
||||
flexGrow: 0,
|
||||
|
||||
'@media (min-width: 601px)': {
|
||||
flexDirection: 'row'
|
||||
}
|
||||
}}
|
||||
>
|
||||
<TimeElapsed
|
||||
startTime={timeEntry.startTime}
|
||||
endTime={timeEntry.endTime}
|
||||
/>
|
||||
<Box
|
||||
sx={{
|
||||
display: 'flex',
|
||||
flexShrink: 0,
|
||||
|
||||
'@media (max-width: 600px)': {
|
||||
marginTop: '0.33rem'
|
||||
}
|
||||
}}
|
||||
>
|
||||
<Menu shadow="md" width={200}>
|
||||
<Menu.Target>
|
||||
<ActionIcon title="Edit" mr="xs">
|
||||
<ActionIcon
|
||||
title="Edit"
|
||||
mr="xs"
|
||||
sx={{
|
||||
marginLeft: 'auto'
|
||||
}}
|
||||
>
|
||||
<Settings size={14} />
|
||||
</ActionIcon>
|
||||
</Menu.Target>
|
||||
|
|
@ -302,7 +349,9 @@ export default function TimeEntriesPage() {
|
|||
<Menu.Item
|
||||
component="button"
|
||||
type="submit"
|
||||
icon={<Trash size={14} color={theme.colors.red[8]} />}
|
||||
icon={
|
||||
<Trash size={14} color={theme.colors.red[8]} />
|
||||
}
|
||||
>
|
||||
Delete
|
||||
</Menu.Item>
|
||||
|
|
@ -364,7 +413,8 @@ export default function TimeEntriesPage() {
|
|||
</ActionIcon>
|
||||
</Form>
|
||||
)}
|
||||
</div>
|
||||
</Box>
|
||||
</Box>
|
||||
</Paper>
|
||||
))}
|
||||
</section>
|
||||
|
|
|
|||
Loading…
Reference in a new issue