-
Notifications
You must be signed in to change notification settings - Fork 16
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 #1435 from ChainSafe/dev
Release latest fixes and updates
- Loading branch information
Showing
93 changed files
with
1,325 additions
and
2,080 deletions.
There are no files selected for viewing
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
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
68 changes: 68 additions & 0 deletions
68
packages/common-components/src/ToggleHiddenText/ToggleHiddenText.tsx
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,68 @@ | ||
import { createStyles, ITheme, makeStyles } from "@chainsafe/common-theme" | ||
import React, { ReactNode, useCallback, useMemo, useState } from "react" | ||
import clsx from "clsx" | ||
import { EyeClosedSvg } from "../Icons/icons/EyeClosed.icon" | ||
import { EyeOpenSvg } from "../Icons/icons/EyeOpen.icon" | ||
|
||
const useStyles = makeStyles(({ constants, overrides }: ITheme) => | ||
createStyles({ | ||
root: { | ||
display: "inline-flex", | ||
flexDirection: "row", | ||
justifyContent: "flex-start", | ||
alignItems: "center", | ||
marginLeft: constants.generalUnit, | ||
...overrides?.ToggleHiddenText?.root | ||
}, | ||
icon: { | ||
marginRight: constants.generalUnit, | ||
cursor: "pointer", | ||
...overrides?.ToggleHiddenText?.icon | ||
} | ||
}) | ||
) | ||
|
||
interface IToggleHiddenText { | ||
children: ReactNode | ||
iconPosition?: "left" | "right" | ||
hiddenLength?: number | ||
className?: string | ||
} | ||
|
||
const ToggleHiddenText = ({ className, iconPosition = "left", hiddenLength = 6, children }: IToggleHiddenText) => { | ||
const classes = useStyles() | ||
const [hidden, setHidden] = useState(true) | ||
const hiddenKey = useMemo(() => new Array(hiddenLength).fill("●"), [hiddenLength]) | ||
|
||
const EyeClosed = useCallback(() => <EyeClosedSvg | ||
className={classes.icon} | ||
onClick={() => setHidden(false)} | ||
/> | ||
, [classes.icon]) | ||
|
||
const EyeOpen = useCallback(() => <EyeOpenSvg | ||
className={classes.icon} | ||
onClick={() => setHidden(true)} | ||
/> | ||
, [classes.icon]) | ||
|
||
return ( | ||
<span className={clsx(classes.root, className)} > | ||
{ | ||
hidden | ||
? <> | ||
{iconPosition === "left" && <EyeClosed />} | ||
<span>{hiddenKey}</span> | ||
{iconPosition === "right" && <EyeClosed />} | ||
</> | ||
: <> | ||
{iconPosition === "left" && <EyeOpen />} | ||
{children} | ||
{iconPosition === "right" && <EyeOpen />} | ||
</> | ||
} | ||
</span> | ||
) | ||
} | ||
|
||
export default ToggleHiddenText |
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,2 @@ | ||
export { default as ToggleHiddenText } from "./ToggleHiddenText" | ||
export * from "./ToggleHiddenText" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export interface IToggleHiddenText { | ||
root?: Record<string, any> | ||
icon?: Record<string, any> | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
{ | ||
"integrationFolder": "cypress/tests", | ||
"video": false | ||
"video": false, | ||
"experimentalSessionSupport": true | ||
} |
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 @@ | ||
export const folderName = "Testing" |
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
Oops, something went wrong.