Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
16 changes: 16 additions & 0 deletions src/assets/icon-collapse.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 29 additions & 0 deletions src/assets/icon-copy.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions src/assets/icon-download-log.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions src/assets/icon-expand.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions src/assets/icon-notification-active.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions src/assets/icon-notification.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions src/assets/icon-ready.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions src/assets/icon-syncing.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
78 changes: 61 additions & 17 deletions src/common/components/data-display/LabeledRow.tsx
Original file line number Diff line number Diff line change
@@ -1,47 +1,91 @@
import { Divider, Grid, makeStyles } from "@material-ui/core";
import FileCopyOutlinedIcon from "@material-ui/icons/FileCopyOutlined";
import { Grid, makeStyles } from "@material-ui/core";
import React, { ReactElement } from "react";
import { copyToClipboard } from "../../utils/appUtil";
import IconButton from "../input/buttons/IconButton";
import { copyIcon } from "../../../common/utils/svgIcons";
import ButtonBase from "@material-ui/core/ButtonBase";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are button components in this project. Let's just use them in order to handle consistent style throughout the project.


type LabeledRowProps = {
label: string;
value: string | number;
paddingSpacing?: number;
showCopyIcon?: boolean;
padding?: string;
reserveSpaceForCopyIcon?: boolean;
statusIcon?: string;
};

const useStyles = makeStyles((theme) => ({
const useStyles = makeStyles(() => ({
cell: (props: LabeledRowProps) => ({
padding: theme.spacing(props.paddingSpacing ?? 2),
textAlign: "center",
padding: props.padding ? props.padding : "15px 40px",
wordWrap: "break-word",
whiteSpace: "pre-wrap",
fontSize: "16px",
}),
textLabel: {
color: "#979797",
},
textValue: {
color: "#f2f2f2",
},
copyIcon: {
paddingRight: "5px",
},
copyContainer: {
cursor: "pointer",
color: "#f15a24",
fontSize: "14px",
display: "flex",
justifyContent: "flex-end",
},
statusContainer: {
display: "flex",
alignItems: "center",
},
statusIcon: {
marginRight: "10px",
},
}));

const LabeledRow = (props: LabeledRowProps): ReactElement => {
const { label, value, showCopyIcon, reserveSpaceForCopyIcon } = props;
const classes = useStyles(props);

return (
<Grid container item justify="space-between" alignItems="center">
<Grid item xs={reserveSpaceForCopyIcon ? 3 : 4} className={classes.cell}>
<Grid container item alignItems="center">
<Grid
item
xs={reserveSpaceForCopyIcon ? 2 : 3}
className={`${classes.cell} ${classes.textLabel}`}
>
{label}
</Grid>
<Divider orientation="vertical" flexItem />
<Grid item xs={reserveSpaceForCopyIcon ? 6 : 7} className={classes.cell}>
{value}

<Grid
item
xs={reserveSpaceForCopyIcon ? 6 : 7}
className={`${classes.cell} ${classes.textValue}`}
>
{props.statusIcon ? (
<div className={classes.statusContainer}>
<img
src={props.statusIcon}
className={classes.statusIcon}
alt="status"
/>
{value}
</div>
) : (
<div>{value}</div>
)}
</Grid>
{reserveSpaceForCopyIcon && (
<Grid item xs={2} className={classes.cell}>
{showCopyIcon && (
<IconButton
icon={<FileCopyOutlinedIcon fontSize="small" />}
tooltipTitle="Copy to clipboard"
onClick={() => copyToClipboard(value)}
/>
<div className={classes.copyContainer}>
<ButtonBase onClick={() => copyToClipboard(value)}>
<img src={copyIcon} alt="copy" className={classes.copyIcon} />
Copy
</ButtonBase>
</div>
Comment on lines +83 to +88
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The icon seems a bit off in two ways:

  1. When the ripple effect appears on click, there's no padding / no space around the text and icon;
  2. On the right of the icon, there's too much space. Would be good to give the content column (middle) more space.

)}
</Grid>
)}
Expand Down
47 changes: 47 additions & 0 deletions src/common/components/data-display/text/PageTitle.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import React, { ReactElement } from "react";
import { Icon } from "@material-ui/core";
import { makeStyles } from "@material-ui/core";
import { notificationIcon } from "../../../utils/svgIcons";

type PageTitleProps = {
title: string;
};

const useStyles = makeStyles(() => ({
headingContainer: {
display: "flex",
alignItems: "center",
},
heading: {
fontSize: "30px",
fontWeight: 500,
},
notificationIconContainer: {
marginLeft: "auto",
},
notificationIcon: {
cursor: "pointer",
},
}));

const PageTitle = (props: PageTitleProps): ReactElement => {
const { title } = props;
const classes = useStyles();

return (
<div className={classes.headingContainer}>
<h1 className={classes.heading}>{title}</h1>
{false && (
<Icon className={classes.notificationIconContainer}>
<img
src={notificationIcon}
alt="notifications"
className={classes.notificationIcon}
/>
</Icon>
)}
</div>
);
};

export default PageTitle;
20 changes: 19 additions & 1 deletion src/common/utils/svgIcons.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
import openDexLogo from "../../assets/OpenDEXLogo.svg";
import expandIcon from "../../assets/icon-expand.svg";
import readyIcon from "../../assets/icon-ready.svg";
import syncingIcon from "../../assets/icon-syncing.svg";
import copyIcon from "../../assets/icon-copy.svg";
import notificationIcon from "../../assets/icon-notification.svg";
import notificationActiveIcon from "../../assets/icon-notification-active.svg";
import downloadIcon from "../../assets/icon-download-log.svg";
import collapseIcon from "../../assets/icon-collapse.svg";

export { openDexLogo };
export {
openDexLogo,
expandIcon,
readyIcon,
syncingIcon,
copyIcon,
notificationIcon,
notificationActiveIcon,
downloadIcon,
collapseIcon,
};
2 changes: 1 addition & 1 deletion src/dashboard/Dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const useStyles = makeStyles((theme: Theme) =>
content: {
marginLeft: drawerWidth,
backgroundColor: theme.palette.background.default,
padding: theme.spacing(3),
padding: theme.spacing(4),
height: "100vh",
display: "flex",
flexDirection: "column",
Expand Down
Loading