-
Notifications
You must be signed in to change notification settings - Fork 4
style: implement new design for Place Order part in Trade path #34
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
import { | ||
CircularProgress, | ||
createStyles, | ||
FormControl, | ||
FormHelperText, | ||
makeStyles, | ||
Theme, | ||
} from "@material-ui/core"; | ||
import React, { ReactElement } from "react"; | ||
import Button from "./Button"; | ||
|
@@ -21,23 +21,36 @@ type ButtonWithLoadingProps = { | |
helperText?: string; | ||
}; | ||
|
||
const useStyles = makeStyles(() => | ||
createStyles({ | ||
buttonWrapper: { | ||
position: "relative", | ||
}, | ||
buttonProgress: { | ||
position: "absolute", | ||
top: "50%", | ||
left: "50%", | ||
marginTop: -12, | ||
marginLeft: -12, | ||
const useStyles = makeStyles((theme: Theme) => ({ | ||
button: (props: ButtonWithLoadingProps) => ({ | ||
borderRadius: "initial", | ||
padding: "12px", | ||
fontSize: "16px", | ||
color: "#0c0c0c", | ||
|
||
"&.Mui-disabled": { | ||
color: "#0c0c0c", | ||
backgroundColor: | ||
props.color === "primary" | ||
? theme.palette.primary.main | ||
: theme.palette.secondary.main, | ||
Comment on lines
+33
to
+36
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Two concerns here:
|
||
opacity: 0.5, | ||
}, | ||
}) | ||
); | ||
}), | ||
buttonWrapper: { | ||
position: "relative", | ||
}, | ||
buttonProgress: { | ||
position: "absolute", | ||
top: "50%", | ||
left: "50%", | ||
marginTop: -12, | ||
marginLeft: -12, | ||
}, | ||
})); | ||
|
||
const ButtonWithLoading = (props: ButtonWithLoadingProps): ReactElement => { | ||
const classes = useStyles(); | ||
const classes = useStyles(props); | ||
const { | ||
onClick, | ||
text, | ||
|
@@ -55,6 +68,7 @@ const ButtonWithLoading = (props: ButtonWithLoadingProps): ReactElement => { | |
<FormControl fullWidth={fullWidth}> | ||
<div className={classes.buttonWrapper}> | ||
<Button | ||
className={classes.button} | ||
text={text} | ||
type={submitButton ? "submit" : "button"} | ||
color={color || "primary"} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
import { | ||
createStyles, | ||
withStyles, | ||
Grid, | ||
makeStyles, | ||
Slider, | ||
Tooltip, | ||
Typography, | ||
} from "@material-ui/core"; | ||
import InfoIcon from "@material-ui/icons/InfoOutlined"; | ||
import { inject, observer } from "mobx-react"; | ||
|
@@ -21,12 +21,72 @@ type AmountDetailsProps = { | |
const useStyles = makeStyles(() => { | ||
return createStyles({ | ||
iconContainer: { | ||
color: "#979797", | ||
display: "flex", | ||
alignItems: "center", | ||
fontSize: "16px", | ||
}, | ||
text: { | ||
color: "#979797", | ||
fontSize: "16px", | ||
Comment on lines
+30
to
+31
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems we could make use of text components that have sizes, colors, etc. Would eliminate duplicate code and make possible restyling and maintaining lot easier. |
||
padding: "2px 0", | ||
}, | ||
textHighlighted: { | ||
color: "#f2f2f2", | ||
}, | ||
toolTip: { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I suppose all the tooltips should look alike, so why not create a component that has those styles and can be used anywhere? |
||
color: "#f2f2f2", | ||
backgroundColor: "#0c0c0c", | ||
fontSize: "13px", | ||
}, | ||
}); | ||
}); | ||
|
||
const CustomSlider = withStyles({ | ||
root: { | ||
padding: "8px 0", | ||
}, | ||
thumb: { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The thumb looks a bit off (it's downwards from the line + the white border is not continuous). |
||
height: "19px", | ||
width: "19px", | ||
border: "2px solid #f2f2f2", | ||
}, | ||
track: { | ||
height: 4, | ||
zIndex: 9999, | ||
}, | ||
rail: { | ||
height: 2, | ||
color: "#636363", | ||
opacity: "1", | ||
}, | ||
mark: { | ||
height: "10px", | ||
width: "1px", | ||
color: "#636363", | ||
"&[data-index='0']": { | ||
display: "none", | ||
}, | ||
"&[data-index='4']": { | ||
display: "none", | ||
}, | ||
}, | ||
markLabel: { | ||
color: "#636363", | ||
fontSize: "12px", | ||
paddingTop: "4px", | ||
"&[data-index='0']": { | ||
paddingLeft: "8px", | ||
}, | ||
"&[data-index='4']": { | ||
paddingRight: "30px", | ||
}, | ||
}, | ||
markLabelActive: { | ||
color: "#f2f2f2", | ||
}, | ||
})(Slider); | ||
|
||
const AmountDetails = inject(TRADE_STORE)( | ||
observer( | ||
(props: AmountDetailsProps): ReactElement => { | ||
|
@@ -46,15 +106,24 @@ const AmountDetails = inject(TRADE_STORE)( | |
return ( | ||
<Grid item container wrap="nowrap" spacing={2} className={className}> | ||
<Grid item container direction="column" xs={4}> | ||
<Typography>Tradable {tradeStore!.baseAsset}</Typography> | ||
<span className={classes.text}> | ||
Tradable {tradeStore!.baseAsset} | ||
</span> | ||
<Grid item container wrap="nowrap" spacing={1}> | ||
<Grid item> | ||
<Typography> | ||
Max: {Number(tradeStore!.currentMaxAmount.toFixed(8))} | ||
</Typography> | ||
<span className={classes.text}> | ||
Max:{" "} | ||
<span className={classes.textHighlighted}> | ||
{Number(tradeStore!.currentMaxAmount.toFixed(8))}{" "} | ||
{tradeStore!.baseAsset} | ||
</span> | ||
</span> | ||
</Grid> | ||
<Grid item className={classes.iconContainer}> | ||
<Tooltip | ||
classes={{ | ||
tooltip: classes.toolTip, | ||
}} | ||
title={ | ||
<> | ||
<div> | ||
|
@@ -79,11 +148,14 @@ const AmountDetails = inject(TRADE_STORE)( | |
</Grid> | ||
</Grid> | ||
<Grid item xs={8}> | ||
<Slider | ||
<CustomSlider | ||
value={tradeStore!.sliderValue} | ||
getAriaValueText={(value) => `${value}%`} | ||
marks={amountMarks.map((mark) => { | ||
return { value: mark, label: `${mark}%` }; | ||
return { | ||
value: mark, | ||
label: mark !== 25 && mark !== 75 ? `${mark}%` : "", | ||
}; | ||
})} | ||
valueLabelDisplay="auto" | ||
valueLabelFormat={(value) => `${value}%`} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe would make sense to define the text colors in theme? Would be great not to define it in every component that uses this text color, and there seem to be many.