Skip to content

Commit

Permalink
fix share list layout
Browse files Browse the repository at this point in the history
  • Loading branch information
ybizeul committed Aug 4, 2024
1 parent 06c8b4b commit 271c76d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
20 changes: 13 additions & 7 deletions html/src/Components/ShareComponent.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ActionIcon, Anchor, Button, CopyButton, Group, Paper, Popover, Text, Tooltip } from "@mantine/core";
import { Share } from "../hupload";
import { ActionIcon, Anchor, Button, CopyButton, Flex, Group, Paper, Popover, Text, Tooltip } from "@mantine/core";
import { humanFileSize, Share } from "../hupload";
import { Link } from "react-router-dom";
import classes from './ShareComponent.module.css';
import { IconLink, IconTrash } from "@tabler/icons-react";
Expand All @@ -16,6 +16,9 @@ export function ShareComponent(props: {share: Share}) {
// Constants
const key = share.name
const name = share.name
const count = share.count
const size = share.size
const countString = count?(count + ' items' + (count > 1 ? 's' : '')):"empty"

// Function
const deleteShare = () => {
Expand All @@ -27,13 +30,16 @@ export function ShareComponent(props: {share: Share}) {
<>
{!deleted &&
<Paper key={key} p="md" shadow="xs" radius="md" mt={10} className={classes.paper}>
<Group justify="space-between" h={45}>
<Anchor component={Link} to={'/'+name}><Text>{name}</Text></Anchor>
<Group>
<Flex h={45} align={"center"}>
<Group flex="1" gap="0" align="baseline">
<Anchor style={{ whiteSpace: "nowrap"}} flex={"1"} component={Link} to={'/'+name}><Text>{name}</Text></Anchor>
<Text size="xs" c="gray">{countString + (size?(' | ' + humanFileSize(size)):'')}</Text>
</Group>
<Group justify="flex-end">
<CopyButton value={window.location.protocol + '//' + window.location.host + '/' + name}>
{({ copied, copy }) => (
<Tooltip withArrow arrowOffset={10} arrowSize={4} label="Copy URL">
<ActionIcon variant="light" color={copied ? 'teal' : 'blue'} onClick={copy} >
<ActionIcon ml="sm" variant="light" color={copied ? 'teal' : 'blue'} onClick={copy} >
<IconLink style={{ width: '70%', height: '70%' }} stroke={1.5}/>
</ActionIcon>
</Tooltip>
Expand All @@ -53,7 +59,7 @@ export function ShareComponent(props: {share: Share}) {
</Popover.Dropdown>
</Popover>
</Group>
</Group>
</Flex>
</Paper>
}
</>
Expand Down
2 changes: 2 additions & 0 deletions html/src/hupload.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
export interface Share {
name: string;
owner: string;
count: number;
size: number;
}

export interface Item {
Expand Down

0 comments on commit 271c76d

Please sign in to comment.