Skip to content

Commit

Permalink
Merge pull request #248 from mrgnlabs/man0s/deposit-stake
Browse files Browse the repository at this point in the history
Man0s/deposit stake
  • Loading branch information
losman0s authored Sep 27, 2023
2 parents b461caf + 04fdd3e commit 6495978
Show file tree
Hide file tree
Showing 8 changed files with 810 additions and 287 deletions.
2 changes: 2 additions & 0 deletions apps/marginfi-v2-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"firebase": "^9.22.1",
"firebase-admin": "^11.9.0",
"jsbi": "^4.3.0",
"lodash.debounce": "^4.0.8",
"next": "13.4.19",
"react": "18.2.0",
"react-dom": "18.2.0",
Expand All @@ -58,6 +59,7 @@
"devDependencies": {
"@mrgnlabs/eslint-config-custom": "*",
"@mrgnlabs/tsconfig": "*",
"@types/lodash.debounce": "^4.0.7",
"@types/node": "18.11.18",
"@types/numeral": "^2.0.2",
"@types/react": "18.0.26",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
import { styled, Switch, SwitchProps } from "@mui/material";
import { Dispatch, SetStateAction } from "react";

interface LstDepositToggleProps extends SwitchProps {
checked: boolean;
setChecked: Dispatch<SetStateAction<boolean>>;
}

const LstDepositToggle = styled(({ checked, setChecked, ...switchProps }: LstDepositToggleProps) => {
const handleChange = () => {
setChecked((prev) => !prev);
};

return (
<Switch
{...switchProps}
focusVisibleClassName=".Mui-focusVisible"
disableRipple
checked={!checked}
onChange={handleChange}
disabled={false}
/>
);
})(({ disabled }) => ({
width: "100%",
height: "100%",
...(disabled ? { cursor: "not-allowed" } : {}),
padding: 0,
backgroundColor: "rgba(0,0,0,1)", // @todo currently transparency is at 1 to hide the center thing that i can't make disappear
borderRadius: 5,
display: "flex",
justifyContent: "center",
alignItems: "center",
fontFamily: "Aeonik Pro",
fontWeight: 400,
"&:before": {
content: '"Tokens"',
width: "50%",
height: "100%",
display: "flex",
justifyContent: "center",
alignItems: "center",
zIndex: 10,
pointerEvents: "none",
},
"&:after": {
content: '"Native Stake"',
width: "50%",
height: "100%",
display: "flex",
justifyContent: "center",
alignItems: "center",
zIndex: 10,
pointerEvents: "none",
},
"& .MuiSwitch-switchBase": {
padding: "0.25rem",
width: "50%",
height: "100%",
display: "flex",
justifyContent: "center",
transitionDuration: "300ms",
transform: "translateX(0%)",
"& + .MuiSwitch-track": {
opacity: 0,
width: 0,
height: "100%",
},
"&.Mui-disabled + .MuiSwitch-track": {
opacity: 0.5,
},
"&.Mui-checked": {
transform: "translateX(100%)",
},
},
"&:hover .MuiSwitch-thumb": {
backgroundColor: "#394147",
},
"& .MuiSwitch-thumb": {
boxSizing: "border-box",
width: "100%",
height: "100%",
backgroundColor: "#2F373D",
borderRadius: 4,
},
}));

export { LstDepositToggle };
Loading

1 comment on commit 6495978

@vercel
Copy link

@vercel vercel bot commented on 6495978 Sep 27, 2023

Choose a reason for hiding this comment

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

Please sign in to comment.