Skip to content

Commit

Permalink
Changed VoterListItem onClick action to open etherscan (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
sepehr2github authored Aug 23, 2023
1 parent 45f2c11 commit 8636dee
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Changed

- `VoterListItem` onClick action to open etherscan

## [0.2.11] - 2023-08-23

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion src/components/listItem/voter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export type ListItemVoterProps = ButtonHTMLAttributes<HTMLButtonElement> & {
walletTag?: TagProps;
voteReplaced?: boolean;
voteReplacedLabel?: string;
onClick: () => null;
onClick: () => void;
};

const colorScheme = (option: string) =>
Expand Down
1 change: 1 addition & 0 deletions src/components/table/votersTable.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,5 @@ Default.args = {
onLoadMore: () => alert('load more clicked'),
showOption: true,
showAmount: true,
explorerURL: 'https://etherscan.io/',
};
6 changes: 5 additions & 1 deletion src/components/table/votersTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export type VotersTableProps = {
showOption?: boolean;
showAmount?: boolean;
pageSize?: number; // number of rows to show
explorerURL: string;
};

const colorScheme = (option: VoterType['walletTag']) => (option === 'You' ? 'neutral' : 'info');
Expand All @@ -35,6 +36,7 @@ export const VotersTable: React.FC<VotersTableProps> = ({
page = 1,
showAmount = false,
pageSize = 3,
explorerURL,
}) => {
const displayedVoters = page * pageSize;

Expand All @@ -46,7 +48,9 @@ export const VotersTable: React.FC<VotersTableProps> = ({
label={shortenAddress(voter.wallet)}
src={voter.src}
option={voter.option}
onClick={() => null}
onClick={() => {
window.open(`${explorerURL}address/${voter.wallet}`, '_blank');
}}
voteReplaced={voter.voteReplaced}
{...(voter.walletTag && {
walletTag: {
Expand Down

0 comments on commit 8636dee

Please sign in to comment.