Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions src/components/AssetDetailsModal/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Asset } from '@polymeshassociation/polymesh-sdk/types';
import { useAssetDetails } from '~/hooks/polymesh/useAssetDetails';
import Modal from '../Modal';
import { AssetDetailsCard } from '../AssetDetailsCard';
import Modal from '../Modal';

interface IAssetDetailsModalProps {
asset: string | Asset;
Expand All @@ -14,7 +14,7 @@ export const AssetDetailsModal: React.FC<IAssetDetailsModalProps> = ({
const { assetDetails, assetDetailsLoading } = useAssetDetails(asset);

return (
<Modal handleClose={toggleModal} customWidth="780px" disableOverflow>
<Modal handleClose={toggleModal} customWidth="780px">
<AssetDetailsCard
assetDetailsLoading={assetDetailsLoading}
assetDetails={assetDetails}
Expand Down
9 changes: 2 additions & 7 deletions src/components/CookieDeclarationModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { useEffect, useRef, useState } from 'react';
import { useTheme } from 'styled-components';
import Modal from '~/components/Modal';
import { useWindowWidth } from '~/hooks/utility';
import { setCookiebotThemeProperties } from '~/utils/cookiebotTheme';
import { isCookiebotEnabled } from '~/utils/cookiebot';
import { setCookiebotThemeProperties } from '~/utils/cookiebotTheme';
import { Button, Heading } from '../UiKit';
import { StyledButtonsWrapper, StyledModalContent } from './styles';

Expand Down Expand Up @@ -171,12 +171,7 @@ const CookieDeclarationModal: React.FC<ICookieDeclarationModalProps> = ({
if (!isOpen || !isDeclarationReady) return null;

return (
<Modal
handleClose={onClose}
customWidth="fit-content"
disableOverflow
flexLayout
>
<Modal handleClose={onClose} customWidth="fit-content" flexLayout>
<Heading type="h2" marginBottom={12}>
Cookie Declaration
</Heading>
Expand Down
10 changes: 2 additions & 8 deletions src/components/Modal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useEffect } from 'react';
import { createPortal } from 'react-dom';
import { useWindowWidth } from '~/hooks/utility';
import Icon from '../Icon';
import { StyledBackdrop, StyledModal, StyledCloseButton } from './styles';
import { StyledBackdrop, StyledCloseButton, StyledModal } from './styles';

interface KeyboardEvent {
key: string;
Expand All @@ -11,7 +11,6 @@ interface KeyboardEvent {
interface IModalProps {
handleClose: () => void | React.ReactEventHandler | React.ChangeEventHandler;
children: React.ReactNode;
disableOverflow?: boolean;
customWidth?: string;
flexLayout?: boolean;
}
Expand All @@ -21,7 +20,6 @@ const modalRoot = document.getElementById('modal-root') as Element;
const Modal: React.FC<IModalProps> = ({
handleClose,
children,
disableOverflow,
customWidth,
flexLayout,
}) => {
Expand Down Expand Up @@ -58,11 +56,7 @@ const Modal: React.FC<IModalProps> = ({

return createPortal(
<StyledBackdrop onMouseDown={handleBackdropClick}>
<StyledModal
$disableOverflow={disableOverflow}
$customWidth={customWidth}
$flexLayout={flexLayout}
>
<StyledModal $customWidth={customWidth} $flexLayout={flexLayout}>
{isMobile && (
<StyledCloseButton onClick={handleClose}>
<Icon name="CloseIcon" size="24px" />
Expand Down
4 changes: 2 additions & 2 deletions src/components/Modal/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ export const StyledBackdrop = styled.div`
`;

export const StyledModal = styled.div<{
$disableOverflow?: boolean;
$customWidth?: string;
$flexLayout?: boolean;
}>`
Expand All @@ -45,12 +44,13 @@ export const StyledModal = styled.div<{
$customWidth ? `${$customWidth}` : '400px'};
max-width: ${({ $customWidth }) =>
$customWidth ? `${$customWidth}` : '504px'};
min-height: 200px;
max-height: 80vh;
border-radius: 8px;
}
background-color: ${({ theme }) => theme.colors.modalBackground};
box-shadow: ${({ theme }) => `0px 20px 40px ${theme.colors.shadow}`};
${({ $disableOverflow }) => ($disableOverflow ? '' : `overflow-y: auto;`)}
overflow-y: auto;

animation: modal-animation 250ms ease-out;
@keyframes modal-animation {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const PopupWelcome = () => {
return null;
}
return (
<Modal handleClose={() => {}} disableOverflow customWidth="fit-content">
<Modal handleClose={() => {}} customWidth="fit-content">
<StyledWelcomeWrapper>
<StyledWelcomePopup>
<h3>Welcome to Polymesh!</h3>
Expand Down
33 changes: 17 additions & 16 deletions src/layouts/Authorizations/components/AddNewAuth/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ export const AddNewAuth: React.FC<IAddNewAuthProps> = ({ toggleModal }) => {
const inputs = configureInputs(selectedAuthType);

return (
<Modal handleClose={toggleModal} disableOverflow>
<Modal handleClose={toggleModal}>
<Heading type="h4" marginBottom={32}>
Create New Authorization
</Heading>
Expand All @@ -156,20 +156,21 @@ export const AddNewAuth: React.FC<IAddNewAuthProps> = ({ toggleModal }) => {
<Text bold marginBottom={3}>
Authorization Type
</Text>
<StyledTypeSelectWrapper ref={typeRef}>
<StyledTypeSelect
onClick={handleTypeDropdownToggle}
$expanded={typeDropdownExpanded}
$isSelected={!!selectedAuthType}
>
<span>
{selectedAuthType
? splitCamelCase(selectedAuthType)
: 'Select Authorization Type'}
</span>

<Icon name="ExpandIcon" size="18px" />
</StyledTypeSelect>
<div ref={typeRef}>
<StyledTypeSelectWrapper>
<StyledTypeSelect
onClick={handleTypeDropdownToggle}
$expanded={typeDropdownExpanded}
$isSelected={!!selectedAuthType}
>
<span>
{selectedAuthType
? splitCamelCase(selectedAuthType)
: 'Select Authorization Type'}
</span>
<Icon name="ExpandIcon" size="18px" />
</StyledTypeSelect>
</StyledTypeSelectWrapper>
{typeDropdownExpanded && (
<StyledExpandedTypeSelect>
{Object.values(AuthorizationType)
Expand All @@ -195,7 +196,7 @@ export const AddNewAuth: React.FC<IAddNewAuthProps> = ({ toggleModal }) => {
))}
</StyledExpandedTypeSelect>
)}
</StyledTypeSelectWrapper>
</div>
{selectedAuthType === 'RotatePrimaryKey' && (
<StyledWarningMessage>
Caution: This will remove the current primary key from your identity
Expand Down
14 changes: 4 additions & 10 deletions src/layouts/Authorizations/components/AddNewAuth/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ export const StyledTypeSelectWrapper = styled.div`
cursor: pointer;
border: 1px solid #8f8f8f;
border-radius: 8px;

@media screen and (min-width: 768px) {
min-width: 456px;
}
`;

export const StyledTypeSelect = styled.div<{
Expand All @@ -36,17 +32,16 @@ export const StyledTypeSelect = styled.div<{
`;

export const StyledExpandedTypeSelect = styled.div`
position: absolute;
top: 110%;
left: 0;
display: flex;
flex-direction: column;
width: 100%;
margin-top: 4px;
padding: 8px;
max-height: 200px;
background-color: ${({ theme }) => theme.colors.landingBackground};
border: 1px solid #8f8f8f;
border-radius: 8px;
overflow-y: scroll;
z-index: 1;
overflow-y: auto;
box-shadow: 0px 20px 40px ${({ theme }) => theme.colors.shadow};
`;

Expand Down Expand Up @@ -106,7 +101,6 @@ export const StyledInputGroup = styled.div`
export const InputWrapper = styled.div<{ $isSelect: boolean }>`
${({ $isSelect }) => ($isSelect ? `grid-column: 1 / 3;` : '')}
position: relative;
/* width: 216px; */
`;

export const StyledInput = styled.input`
Expand Down
2 changes: 1 addition & 1 deletion src/layouts/Settings/components/DefaultAddress/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export const DefaultAddress = () => {
)}
</StyledValue>
{addressSelectExpanded && (
<Modal handleClose={toggleModal} disableOverflow>
<Modal handleClose={toggleModal}>
<Heading type="h4" marginBottom={48}>
Default Wallet Address
</Heading>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export const CreateVenue: React.FC<ICreateVenueProps> = ({ toggleModal }) => {
}
};
return (
<Modal handleClose={toggleModal} disableOverflow>
<Modal handleClose={toggleModal}>
<Heading type="h4" marginBottom={32}>
Create New Venue
</Heading>
Expand Down