-
Notifications
You must be signed in to change notification settings - Fork 27
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 #240 from gnosisguild/roles-multiple-unwrappers
Adjust default multisend configuration in Roles v2 setup flow
- Loading branch information
Showing
13 changed files
with
328 additions
and
173 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
import { Grid, makeStyles, Typography } from "@material-ui/core" | ||
import React from "react" | ||
import { colors, ZodiacPaper } from "zodiac-ui-components" | ||
import Creatable from "react-select/creatable" | ||
import { CreatableProps } from "react-select/creatable" | ||
import { GroupBase } from "react-select" | ||
|
||
const components = { | ||
DropdownIndicator: null, | ||
} | ||
|
||
export interface MultiSelectValues { | ||
label: string | ||
value: string | ||
} | ||
|
||
const useStyles = makeStyles((theme) => ({ | ||
paperContainer: { | ||
background: "rgba(0, 0, 0, 0.2)", | ||
}, | ||
message: { | ||
fontSize: 12, | ||
color: "rgba(244, 67, 54, 1)", | ||
}, | ||
})) | ||
|
||
const customStyles = { | ||
control: (base: any, state: { isFocused: any }) => ({ | ||
...base, | ||
background: "none", | ||
width: "100%", | ||
border: "none", | ||
fontFamily: "Roboto Mono !important", | ||
color: "yellow !important", | ||
boxShadow: state.isFocused ? null : null, | ||
"&:hover": { | ||
border: "none", | ||
}, | ||
}), | ||
option: (base: any) => ({ | ||
...base, | ||
color: "white", | ||
backgroundColor: "#101010", | ||
cursor: "pointer", | ||
}), | ||
menu: (base: any) => ({ | ||
...base, | ||
// override border radius to match the box | ||
borderRadius: 0, | ||
backgroundColor: "#101010", | ||
// kill the gap | ||
marginTop: 0, | ||
}), | ||
menuList: (base: any) => ({ | ||
...base, | ||
// kill the white space on first and last option | ||
padding: 0, | ||
}), | ||
ValueContainer: (base: any) => ({ | ||
...base, | ||
display: "block", | ||
}), | ||
multiValue: (base: any) => ({ | ||
...base, | ||
color: "white !important", | ||
background: colors.tan[300], | ||
"&:hover": { | ||
background: colors.tan[300], | ||
}, | ||
"& > div": { | ||
color: `white !important`, | ||
}, | ||
"& > div[role=button]:hover": { | ||
cursor: "pointer", | ||
color: "blue", | ||
background: colors.tan[500], | ||
}, | ||
}), | ||
} | ||
|
||
interface MultiSelectBlockCustomProps | ||
extends CreatableProps<MultiSelectValues, true, GroupBase<MultiSelectValues>> { | ||
invalidText?: string | ||
} | ||
|
||
export const MultiSelectBlock: React.FC<MultiSelectBlockCustomProps> = (props) => { | ||
const classes = useStyles() | ||
|
||
return ( | ||
<Grid container spacing={1} direction="column"> | ||
<Grid item> | ||
<ZodiacPaper className={classes.paperContainer} borderStyle="double"> | ||
<Creatable | ||
{...props} | ||
components={components} | ||
placeholder="Paste an address and press enter..." | ||
isMulti | ||
isClearable={false} | ||
styles={customStyles} | ||
options={props.options} | ||
theme={(theme) => ({ | ||
...theme, | ||
colors: { | ||
...theme.colors, | ||
font: "#101010", | ||
primary25: "#101010", | ||
primary: "#101010", | ||
neutral80: "white", | ||
}, | ||
})} | ||
/> | ||
</ZodiacPaper> | ||
</Grid> | ||
{props.invalidText && ( | ||
<Grid item> | ||
<Typography className={classes.message}>{props.invalidText}</Typography> | ||
</Grid> | ||
)} | ||
</Grid> | ||
) | ||
} |
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
22 changes: 11 additions & 11 deletions
22
packages/app/src/components/ethereum/AddressExplorerButton.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 |
---|---|---|
@@ -1,19 +1,19 @@ | ||
import React from "react"; | ||
import { ExplorerButton } from "@gnosis.pm/safe-react-components"; | ||
import { useSafeAppsSDK } from "@gnosis.pm/safe-apps-react-sdk"; | ||
import { getExplorerInfo } from "../../utils/explorers"; | ||
import React from "react" | ||
import { ExplorerButton } from "@gnosis.pm/safe-react-components" | ||
import { useSafeAppsSDK } from "@gnosis.pm/safe-apps-react-sdk" | ||
import { getExplorerInfo } from "../../utils/explorers" | ||
|
||
interface AddressExplorerButtonProps { | ||
className?: string; | ||
address: string; | ||
className?: string | ||
address: string | ||
} | ||
|
||
export const AddressExplorerButton = ({ | ||
address, | ||
className, | ||
}: AddressExplorerButtonProps) => { | ||
const { safe } = useSafeAppsSDK(); | ||
const safeExplorer = getExplorerInfo(safe.chainId, address); | ||
if (!safeExplorer) return null; | ||
return <ExplorerButton explorerUrl={safeExplorer} className={className} />; | ||
}; | ||
const { safe } = useSafeAppsSDK() | ||
const safeExplorer = getExplorerInfo(safe.chainId, address) | ||
if (!safeExplorer) return null | ||
return <ExplorerButton explorerUrl={safeExplorer} className={className} /> | ||
} |
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
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.