-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1174 from bluewave-labs/feat/fe/refactor/input
Feat/fe/refactor/input
- Loading branch information
Showing
8 changed files
with
584 additions
and
20 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
Client/src/Components/Inputs/TextInput/Adornments/index.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import { Stack, Typography, InputAdornment, IconButton } from "@mui/material"; | ||
import { useTheme } from "@mui/material/styles"; | ||
import { useState } from "react"; | ||
import PropTypes from "prop-types"; | ||
import VisibilityOff from "@mui/icons-material/VisibilityOff"; | ||
import Visibility from "@mui/icons-material/Visibility"; | ||
export const HttpAdornment = ({ https }) => { | ||
const theme = useTheme(); | ||
return ( | ||
<Stack | ||
direction="row" | ||
alignItems="center" | ||
height="100%" | ||
sx={{ | ||
borderRight: `solid 1px ${theme.palette.border.dark}`, | ||
backgroundColor: theme.palette.background.accent, | ||
pl: theme.spacing(6), | ||
}} | ||
> | ||
<Typography | ||
component="h5" | ||
paddingRight={"var(--env-var-spacing-1-minus)"} | ||
color={theme.palette.text.secondary} | ||
sx={{ lineHeight: 1, opacity: 0.8 }} | ||
> | ||
{https ? "https" : "http"}:// | ||
</Typography> | ||
</Stack> | ||
); | ||
}; | ||
|
||
export const PasswordEndAdornment = ({ fieldType, setFieldType }) => { | ||
const theme = useTheme(); | ||
return ( | ||
<InputAdornment position="end"> | ||
<IconButton | ||
aria-label="toggle password visibility" | ||
onClick={() => setFieldType(fieldType === "password" ? "text" : "password")} | ||
sx={{ | ||
color: theme.palette.border.dark, | ||
padding: theme.spacing(1), | ||
"&:focus-visible": { | ||
outline: `2px solid ${theme.palette.primary.main}`, | ||
outlineOffset: `2px`, | ||
}, | ||
"& .MuiTouchRipple-root": { | ||
pointerEvents: "none", | ||
display: "none", | ||
}, | ||
}} | ||
> | ||
{fieldType === "password" ? <VisibilityOff /> : <Visibility />} | ||
</IconButton> | ||
</InputAdornment> | ||
); | ||
}; | ||
|
||
HttpAdornment.propTypes = { | ||
https: PropTypes.bool.isRequired, | ||
}; |
Oops, something went wrong.