-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update content of popup window (#168)
- Loading branch information
Showing
25 changed files
with
506 additions
and
408 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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
import classNames from 'classnames' | ||
import { createElement, HTMLProps, PropsWithChildren, ReactNode } from 'react' | ||
|
||
import ConnectSiteInfo from '~/popup/components/connectSiteInfo' | ||
import { IPopupPageProps } from '~/popup/types' | ||
import { MethodEnum } from '~/types/extension' | ||
|
||
interface IAction | ||
extends PropsWithChildren<Omit<HTMLProps<HTMLButtonElement>, 'type'>> { | ||
type?: 'submit' | ||
} | ||
|
||
interface IProps { | ||
title: ReactNode | ||
description?: ReactNode | ||
actions?: IAction[] | ||
className?: string | ||
as?: keyof JSX.IntrinsicElements | ||
} | ||
|
||
const PopupLayout = <TTag extends keyof JSX.IntrinsicElements>({ | ||
title, | ||
description, | ||
request, | ||
controller, | ||
children, | ||
actions = [], | ||
className, | ||
as = 'div', | ||
...rest | ||
}: PropsWithChildren< | ||
IProps & | ||
Partial<IPopupPageProps<MethodEnum.REQUEST | MethodEnum.ENABLE>> & | ||
JSX.IntrinsicElements[TTag] | ||
>) => { | ||
return createElement( | ||
as, | ||
{ | ||
className: | ||
'container flex flex-col w-full h-full pt-8 pb-10 mx-auto', | ||
...rest, | ||
}, | ||
<> | ||
{/* // * popup title */} | ||
<div className="flex flex-col items-center gap-5 text-dark-scale-100"> | ||
{request && controller && ( | ||
<ConnectSiteInfo | ||
request={request} | ||
controller={controller} | ||
/> | ||
)} | ||
<div className="text-headline2">{title}</div> | ||
{description && <div className="text-body1">{description}</div>} | ||
</div> | ||
{/* // * popup content */} | ||
<div className={classNames('flex flex-col gap-4 grow', className)}> | ||
{children} | ||
</div> | ||
{/* // * popup actions */} | ||
<div className="flex gap-4 justify-center"> | ||
{actions.map(({ children, ...rest }, index) => ( | ||
<button | ||
key={index} | ||
className="btn btn-CTA_landing btn-large odd:btn-outline flex-1 max-w-[50%]" | ||
{...rest} | ||
> | ||
{children} | ||
</button> | ||
))} | ||
</div> | ||
</> | ||
) | ||
} | ||
|
||
export default PopupLayout |
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,21 @@ | ||
import { t } from 'i18next' | ||
import { observer } from 'mobx-react-lite' | ||
|
||
import rootStore from '~/store' | ||
import { shortenHash } from '~/utils' | ||
|
||
const AddressInfo = () => { | ||
const { | ||
walletStore: { address }, | ||
} = rootStore | ||
const shortenAddress = shortenHash(address) | ||
|
||
return ( | ||
<div className="flex flex-col gap-2 text-body2 text-primary-100"> | ||
{t('current-address')} | ||
<div className="info-box h-10">{shortenAddress}</div> | ||
</div> | ||
) | ||
} | ||
|
||
export default observer(AddressInfo) |
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,7 @@ | ||
export { default as AddressInfo } from './addressInfo' | ||
export { default as ConnectSiteInfo } from './connectSiteInfo' | ||
export { default as OfferInfo } from './offerInfo' | ||
export { default as SpendBundleInfo } from './spendBundleInfo' | ||
export * from './transactionInfo' | ||
export { default as TransactionInfo } from './transactionInfo' | ||
export { default as TransferInfo } from './transferInfo' |
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.