-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
194 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { PluginWallet } from './PluginWallet'; | ||
import WalletActive from '../../assets/plugins/wallet/walletActive.svg'; | ||
import WalletInactive from '../../assets/plugins/wallet/walletInactive.svg'; | ||
|
||
export default { title: 'Components/PluginWallet', component: PluginWallet }; | ||
|
||
export const _PluginWalletActive = { | ||
render: () => ( | ||
<PluginWallet | ||
isActive={true} | ||
title={'Massawallet'} | ||
iconActive={<WalletActive />} | ||
iconInactive={<WalletInactive />} | ||
onClickActive={() => console.log('intall')} | ||
onClickInactive={() => console.log('launch')} | ||
/> | ||
), | ||
}; | ||
|
||
export const _PluginWalletIncative = { | ||
render: () => ( | ||
<PluginWallet | ||
isActive={false} | ||
title={'Massawallet'} | ||
iconActive={<WalletActive />} | ||
iconInactive={<WalletInactive />} | ||
onClickActive={() => console.log('intall')} | ||
onClickInactive={() => console.log('launch')} | ||
/> | ||
), | ||
}; |
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,23 @@ | ||
import { render, screen } from '@testing-library/react'; | ||
import '@testing-library/jest-dom'; | ||
|
||
import { PluginWallet } from './PluginWallet'; | ||
|
||
describe('Components | PluginWallet', () => { | ||
test('it should render', () => { | ||
render( | ||
<PluginWallet | ||
isActive={true} | ||
title={'Massawallet'} | ||
iconActive={null} | ||
iconInactive={null} | ||
onClickActive={() => console.log('intall')} | ||
onClickInactive={() => console.log('launch')} | ||
/>, | ||
); | ||
|
||
let pluginWallet = screen.getByTestId('pluginWallet'); | ||
|
||
expect(pluginWallet).toBeInTheDocument(); | ||
}); | ||
}); |
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,95 @@ | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
import React from 'react'; | ||
|
||
import { ReactNode } from 'react'; | ||
import { Button } from '../Button'; | ||
import { FiArrowUpRight } from 'react-icons/fi'; | ||
|
||
export interface PluginWalletProps { | ||
isActive: boolean; | ||
title: string; | ||
iconActive: ReactNode; | ||
iconInactive: ReactNode; | ||
onClickActive: () => void; | ||
onClickInactive: () => void; | ||
} | ||
|
||
export interface ActivePluginProps { | ||
title: string; | ||
iconActive: ReactNode; | ||
onClickActive: () => void; | ||
} | ||
|
||
export interface InactivePluginProps { | ||
title: string; | ||
iconInactive: ReactNode; | ||
onClickInactive: () => void; | ||
} | ||
|
||
export function ActivePlugin(props: ActivePluginProps) { | ||
const { title, iconActive, onClickActive } = props; | ||
|
||
return ( | ||
<> | ||
{iconActive} | ||
<div className="w-full py-6 text-f-primary bg-secondary flex flex-col items-center"> | ||
<div className="w-4/5 px-4 py-2 text-center mas-subtitle min-[450px]:mas-title"> | ||
{title} | ||
</div> | ||
<div className="w-4/5 px-4 py-2"> | ||
<Button onClick={onClickActive} preIcon={<FiArrowUpRight />}> | ||
Launch | ||
</Button> | ||
</div> | ||
</div> | ||
</> | ||
); | ||
} | ||
|
||
export function InactivePlugin(props: InactivePluginProps) { | ||
const { title, iconInactive, onClickInactive } = props; | ||
|
||
return ( | ||
<> | ||
{iconInactive} | ||
<div className="w-full py-6 text-f-primary bg-secondary flex flex-col items-center"> | ||
<div className="w-4/5 px-4 py-2 text-center mas-buttons"> | ||
{`${title} is not installed in your station`} | ||
</div> | ||
<div className="w-4/5 px-4 py-2"> | ||
<Button onClick={onClickInactive}>Install</Button> | ||
</div> | ||
</div> | ||
</> | ||
); | ||
} | ||
|
||
export function PluginWallet(props: PluginWalletProps) { | ||
const { | ||
isActive, | ||
title, | ||
iconActive, | ||
iconInactive, | ||
onClickActive, | ||
onClickInactive, | ||
} = props; | ||
|
||
return ( | ||
<div data-testid="pluginWallet" className="w-full sm:w-80 flex flex-col"> | ||
{isActive ? ( | ||
<ActivePlugin | ||
title={title} | ||
iconActive={iconActive} | ||
onClickActive={onClickActive} | ||
/> | ||
) : ( | ||
<InactivePlugin | ||
title={title} | ||
iconInactive={iconInactive} | ||
onClickInactive={onClickInactive} | ||
/> | ||
)} | ||
</div> | ||
); | ||
} |
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 @@ | ||
export * from './PluginWallet'; |