diff options
author | Sebastian <sebasjm@gmail.com> | 2021-07-16 12:00:39 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2021-07-16 12:00:41 -0300 |
commit | 56902288c6ce498cdfbd80ac9036cd457872a73b (patch) | |
tree | d8c6fa70edcaadc33859df4817ab40c4f469057e /packages/taler-wallet-webextension/src/popup | |
parent | 2b9686ccc69d39140d83efe0bfc6ebb2b77ff140 (diff) | |
download | wallet-core-56902288c6ce498cdfbd80ac9036cd457872a73b.tar.xz |
added fake header to stories
Diffstat (limited to 'packages/taler-wallet-webextension/src/popup')
4 files changed, 64 insertions, 16 deletions
diff --git a/packages/taler-wallet-webextension/src/popup/Balance.stories.tsx b/packages/taler-wallet-webextension/src/popup/Balance.stories.tsx index b661ac679..a1b5e7c52 100644 --- a/packages/taler-wallet-webextension/src/popup/Balance.stories.tsx +++ b/packages/taler-wallet-webextension/src/popup/Balance.stories.tsx @@ -19,9 +19,7 @@ * @author Sebastian Javier Marchano (sebasjm) */ -import { ProviderPaymentType } from '@gnu-taler/taler-wallet-core'; -import { addDays } from 'date-fns'; -import { ComponentChild, ComponentChildren, FunctionalComponent, h } from 'preact'; +import { ComponentChildren, FunctionalComponent, h } from 'preact'; import { BalanceView as TestedComponent } from './BalancePage'; export default { diff --git a/packages/taler-wallet-webextension/src/popup/BalancePage.tsx b/packages/taler-wallet-webextension/src/popup/BalancePage.tsx index 24744d3f2..cff17af1a 100644 --- a/packages/taler-wallet-webextension/src/popup/BalancePage.tsx +++ b/packages/taler-wallet-webextension/src/popup/BalancePage.tsx @@ -16,7 +16,6 @@ import { amountFractionalBase, Amounts, - Balance, BalancesResponse, i18n } from "@gnu-taler/taler-util"; @@ -41,7 +40,7 @@ export function BalanceView({ balance, Linker }: BalanceViewProps) { if (balance.error) { return ( - <div class="balance"> + <div> <p>{i18n.str`Error: could not retrieve balance information.`}</p> <p> Click <Linker pageName="welcome.html">here</Linker> for help and diff --git a/packages/taler-wallet-webextension/src/popup/Popup.stories.tsx b/packages/taler-wallet-webextension/src/popup/Popup.stories.tsx new file mode 100644 index 000000000..ec3634d9b --- /dev/null +++ b/packages/taler-wallet-webextension/src/popup/Popup.stories.tsx @@ -0,0 +1,50 @@ +/* + This file is part of GNU Taler + (C) 2021 Taler Systems S.A. + + GNU Taler is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ + +/** +* +* @author Sebastian Javier Marchano (sebasjm) +*/ + +import { Fragment, FunctionalComponent } from 'preact'; +import { NavBar as TestedComponent } from './popup'; + +export default { + title: 'popup/header', + // component: TestedComponent, + argTypes: { + onRetry: { action: 'onRetry' }, + onDelete: { action: 'onDelete' }, + onBack: { action: 'onBack' }, + } +}; + + +function createExample<Props>(Component: FunctionalComponent<Props>, props: Partial<Props>) { + const r = (args: any) => <Component {...args} /> + r.args = props + return r +} + +export const OnBalance = createExample(TestedComponent, { + devMode:false, + path:'/balance' +}); + +export const OnHistoryWithDevMode = createExample(TestedComponent, { + devMode:true, + path:'/history' +}); diff --git a/packages/taler-wallet-webextension/src/popup/popup.tsx b/packages/taler-wallet-webextension/src/popup/popup.tsx index f7b3cec94..32ff10a85 100644 --- a/packages/taler-wallet-webextension/src/popup/popup.tsx +++ b/packages/taler-wallet-webextension/src/popup/popup.tsx @@ -28,6 +28,7 @@ import { i18n } from "@gnu-taler/taler-util"; import { ComponentChildren, JSX } from "preact"; import Match from "preact-router/match"; import { useDevContext } from "../context/useDevContext"; +import { PopupNavigation } from '../components/styled' export enum Pages { balance = '/balance', @@ -58,18 +59,18 @@ function Tab(props: TabProps): JSX.Element { ); } +export function NavBar({devMode, path}:{path:string, devMode:boolean}) { + return <PopupNavigation> + <Tab target="/balance" current={path}>{i18n.str`Balance`}</Tab> + <Tab target="/history" current={path}>{i18n.str`History`}</Tab> + <Tab target="/backup" current={path}>{i18n.str`Backup`}</Tab> + <Tab target="/settings" current={path}>{i18n.str`Settings`}</Tab> + {devMode && <Tab target="/dev" current={path}>{i18n.str`Dev`}</Tab>} + </PopupNavigation> +} + export function WalletNavBar() { const { devMode } = useDevContext() - return <Match>{({ path }: any) => { - return ( - <div class="nav" id="header"> - <Tab target="/balance" current={path}>{i18n.str`Balance`}</Tab> - <Tab target="/history" current={path}>{i18n.str`History`}</Tab> - <Tab target="/backup" current={path}>{i18n.str`Backup`}</Tab> - <Tab target="/settings" current={path}>{i18n.str`Settings`}</Tab> - {devMode && <Tab target="/dev" current={path}>{i18n.str`Dev`}</Tab>} - </div> - ) - }}</Match> + return <Match>{({ path }: any) => <NavBar devMode={devMode} path={path} />}</Match> } |