-
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
lilyanB
committed
Jun 9, 2023
1 parent
36293f7
commit d7fb9fb
Showing
6 changed files
with
152 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={<></>} | ||
iconInactive={<></>} | ||
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,53 @@ | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
import React from 'react'; | ||
|
||
import { Button } from '../Button'; | ||
import { FiArrowUpRight } from 'react-icons/fi'; | ||
|
||
export interface PluginWalletProps { | ||
isActive: boolean; | ||
title: string; | ||
iconActive: JSX.Element; | ||
iconInactive: JSX.Element; | ||
onClickActive: () => void; | ||
onClickInactive: () => void; | ||
} | ||
|
||
export function PluginWallet(props: PluginWalletProps) { | ||
const { | ||
isActive, | ||
title, | ||
iconActive, | ||
iconInactive, | ||
onClickActive, | ||
onClickInactive, | ||
} = props; | ||
|
||
const argsButtons = { | ||
onClick: isActive ? onClickInactive : onClickActive, | ||
preIcon: isActive ? <FiArrowUpRight /> : null, | ||
}; | ||
|
||
return ( | ||
<div data-testid="pluginWallet" className="w-full sm:w-80 flex flex-col"> | ||
{isActive ? iconActive : iconInactive} | ||
<div className="w-full py-6 text-f-primary bg-secondary flex flex-col items-center"> | ||
<div | ||
className={`-2/3 px-4 py-2 text-center ${ | ||
isActive ? 'mas-title' : 'mas-buttons' | ||
}`} | ||
> | ||
{isActive ? title : `${title} is not installed in your station`} | ||
</div> | ||
<div className="px-4 py-2"> | ||
{isActive ? ( | ||
<Button {...argsButtons}>Launch</Button> | ||
) : ( | ||
<Button {...argsButtons}>Install</Button> | ||
)} | ||
</div> | ||
</div> | ||
</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'; |