mirror of
https://github.com/lemeow125/EquipmentTracker-Frontend.git
synced 2024-11-17 06:09:25 +08:00
Separate button icons and buttons themselves to address mobile issue of buttons not functioning when clicking the enveloped icon
This commit is contained in:
parent
a14b09f2a0
commit
ab2525ad95
2 changed files with 61 additions and 65 deletions
|
@ -56,11 +56,7 @@ export default function Drawer() {
|
|||
marginBottom: 8,
|
||||
}}
|
||||
/>
|
||||
<DrawerButton
|
||||
onClick={() => {
|
||||
navigate("/dashboard");
|
||||
}}
|
||||
icon={
|
||||
<div style={styles.flex_row}>
|
||||
<HomeIcon
|
||||
style={{
|
||||
width: "48px",
|
||||
|
@ -71,9 +67,24 @@ export default function Drawer() {
|
|||
justifySelf: "center",
|
||||
}}
|
||||
/>
|
||||
}
|
||||
<DrawerButton
|
||||
onClick={() => {
|
||||
navigate("/dashboard");
|
||||
}}
|
||||
label={"Dashboard"}
|
||||
/>
|
||||
</div>
|
||||
<div style={styles.flex_row}>
|
||||
<LogoutIcon
|
||||
style={{
|
||||
width: "48px",
|
||||
height: "48px",
|
||||
color: "white",
|
||||
marginRight: "2px",
|
||||
alignSelf: "center",
|
||||
justifySelf: "center",
|
||||
}}
|
||||
/>
|
||||
<DrawerButton
|
||||
onClick={async () => {
|
||||
navigate("/");
|
||||
|
@ -91,20 +102,9 @@ export default function Drawer() {
|
|||
theme: "light",
|
||||
});
|
||||
}}
|
||||
icon={
|
||||
<LogoutIcon
|
||||
style={{
|
||||
width: "48px",
|
||||
height: "48px",
|
||||
color: "white",
|
||||
marginRight: "2px",
|
||||
alignSelf: "center",
|
||||
justifySelf: "center",
|
||||
}}
|
||||
/>
|
||||
}
|
||||
label={"Log out"}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@ import { colors } from "../../styles";
|
|||
export interface props {
|
||||
onClick: React.MouseEventHandler<HTMLButtonElement>;
|
||||
children?: React.ReactNode;
|
||||
icon?: React.ReactNode;
|
||||
label: string;
|
||||
}
|
||||
export default function DrawerButton(props: props) {
|
||||
|
@ -23,8 +22,8 @@ export default function DrawerButton(props: props) {
|
|||
onMouseLeave={() => setClicked(false)}
|
||||
style={{
|
||||
borderRadius: 24,
|
||||
minWidth: "128px",
|
||||
maxWidth: "128px",
|
||||
minWidth: "192px",
|
||||
maxWidth: "192px",
|
||||
borderColor: colors.button_border,
|
||||
borderStyle: "solid",
|
||||
borderWidth: "2px",
|
||||
|
@ -34,21 +33,18 @@ export default function DrawerButton(props: props) {
|
|||
paddingLeft: "4px",
|
||||
marginBottom: "4px",
|
||||
marginTop: "4px",
|
||||
backgroundColor: clicked ? colors.button_light : colors.button_dark,
|
||||
backgroundColor: clicked ? colors.button_dark : colors.button_light,
|
||||
}}
|
||||
>
|
||||
<div style={styles.flex_row}>
|
||||
{clicked ? <></> : props.icon}
|
||||
<p
|
||||
style={{
|
||||
...(clicked ? styles.text_dark : styles.text_light),
|
||||
...(clicked ? styles.text_light : styles.text_dark),
|
||||
...styles.text_M,
|
||||
...{ marginLeft: "4px" },
|
||||
...{ textAlign: "left", marginLeft: "4px" },
|
||||
}}
|
||||
>
|
||||
{props.label}
|
||||
</p>
|
||||
</div>
|
||||
</button>
|
||||
</div>
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue