Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve credential selector #383

Merged
merged 4 commits into from
Sep 5, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions packages/browser-wallet/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## Unreleased

### Fixed

- UI improvements to the credential selector.

## 1.1.5

### Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import Button from '@popup/shared/Button';
import Modal from '@popup/shared/Modal';
import React, { ComponentType, useState } from 'react';
import ArrowIcon from '@assets/svg/down-arrow.svg';
import CheckmarkIcon from '@assets/svg/check_small.svg';

interface Props<T> {
/**
Expand Down Expand Up @@ -39,7 +40,8 @@ export default function CredentialSelector<T extends string | number | object>({

return (
<Modal
disableClose
stableScrollbarGutter
showCloseButton={false}
open={open}
onOpen={() => setOpen(true)}
onClose={() => setOpen(false)}
Expand All @@ -63,6 +65,7 @@ export default function CredentialSelector<T extends string | number | object>({
onClick={() => onClick(index)}
>
<DisplayOption option={options[index]} />
{chosenIndex === index && <CheckmarkIcon className="verifiable-credential__selector-item-icon" />}
</Button>
))}
</Modal>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,19 @@ $standard-box-shadow: 0 0 15px 0 rgb(0 0 0 / $color-shadow-alpha);
&__selector-item {
width: calc(100% - 32px);
margin: 5px 16px;
display: flex;
justify-content: space-between;
align-items: center;

&:not(:last-child) {
border-bottom: 1px solid $color-neutral-gray-10;
}

&-icon {
height: 20px;
width: 20px;
margin-right: 10px;
}
}

&__selector-header {
Expand Down
7 changes: 6 additions & 1 deletion packages/browser-wallet/src/popup/shared/Modal/Modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ export type ModalProps<T extends WithOnClick = WithOnClick> = {
bottom?: boolean;
middle?: boolean;
stableScrollbarGutter?: boolean;
// Determines whether to show the close button if disableClose === true.
showCloseButton?: boolean;
/**
* Used to overwrite styling for the modal content box
*/
Expand All @@ -79,6 +81,7 @@ export default function Modal<T extends WithOnClick = WithOnClick>({
bottom = false,
middle = false,
stableScrollbarGutter = false,
showCloseButton = true,
orhoj marked this conversation as resolved.
Show resolved Hide resolved
children,
}: PropsWithChildren<ModalProps<T>>): JSX.Element | null {
const [{ isOpen, isExiting }, setOpenState] = useState<OpenState>({ isOpen: false, isExiting: false });
Expand Down Expand Up @@ -167,7 +170,9 @@ export default function Modal<T extends WithOnClick = WithOnClick>({
transition={defaultTransition}
onClickOutside={close}
>
{!disableClose && <CloseButton className="modal__close" onClick={() => close()} />}
{!disableClose && showCloseButton && (
<CloseButton className="modal__close" onClick={() => close()} />
)}
{children}
</DetectClickOutside>
)}
Expand Down
Loading