wallet-core/packages/taler-wallet-webextension/src/components/Banner.stories.tsx

127 lines
3.3 KiB
TypeScript
Raw Normal View History

2022-03-11 03:13:10 +01:00
/*
This file is part of GNU Taler
2022-06-06 17:05:26 +02:00
(C) 2022 Taler Systems S.A.
2022-03-11 03:13:10 +01:00
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)
*/
2022-03-11 06:17:40 +01:00
import { Fragment, h, VNode } from "preact";
2022-03-29 04:41:07 +02:00
import { Avatar } from "../mui/Avatar.js";
import { Typography } from "../mui/Typography.js";
2022-03-29 05:45:17 +02:00
import { Banner } from "./Banner.js";
import { SvgIcon } from "./styled/index.js";
import wifiIcon from "../svg/wifi.svg";
2022-03-11 03:13:10 +01:00
export default {
2022-12-06 15:28:56 +01:00
title: "banner",
2022-03-11 03:13:10 +01:00
component: Banner,
};
2022-03-29 05:45:17 +02:00
function Wrapper({ children }: any): VNode {
2022-03-11 03:13:10 +01:00
return (
<div
style={{
display: "flex",
backgroundColor: "lightgray",
padding: 10,
width: "100%",
// width: 400,
// height: 400,
justifyContent: "center",
}}
>
<div style={{ flexGrow: 1 }}>{children}</div>
</div>
);
}
2022-03-11 06:17:40 +01:00
function SignalWifiOffIcon({ ...rest }: any): VNode {
2022-03-29 05:45:17 +02:00
return <SvgIcon {...rest} dangerouslySetInnerHTML={{ __html: wifiIcon }} />;
2022-03-11 06:17:40 +01:00
}
2022-03-11 03:13:10 +01:00
export const BasicExample = (): VNode => (
2022-03-11 03:13:10 +01:00
<Fragment>
<Wrapper>
2022-03-11 06:17:40 +01:00
<p>
Example taken from:
<a
target="_blank"
rel="noreferrer"
href="https://medium.com/material-ui/introducing-material-ui-design-system-93e921beb8df"
>
https://medium.com/material-ui/introducing-material-ui-design-system-93e921beb8df
</a>
</p>
<Banner
2023-01-04 15:24:58 +01:00
// elements={[
// {
// icon: <SignalWifiOffIcon color="gray" />,
// description: (
// <Typography>
// You have lost connection to the internet. This app is offline.
// </Typography>
// ),
// },
// ]}
2022-03-11 06:17:40 +01:00
confirm={{
label: "turn on wifi",
2022-06-01 20:47:47 +02:00
action: async () => {
return;
2022-03-11 06:17:40 +01:00
},
}}
2023-01-04 15:24:58 +01:00
>
<div />
</Banner>
2022-03-11 06:17:40 +01:00
</Wrapper>
</Fragment>
);
export const PendingOperation = (): VNode => (
2022-03-11 06:17:40 +01:00
<Fragment>
<Wrapper>
<Banner
title="PENDING TRANSACTIONS"
2022-03-11 15:14:27 +01:00
style={{ backgroundColor: "lightcyan", padding: 8 }}
2023-01-04 15:24:58 +01:00
// elements={[
// {
// icon: (
// <Avatar
// style={{
// border: "solid blue 1px",
// color: "blue",
// boxSizing: "border-box",
// }}
// >
// P
// </Avatar>
// ),
// description: (
// <Fragment>
// <Typography inline bold>
// EUR 37.95
// </Typography>
// &nbsp;
// <Typography inline>- 5 feb 2022</Typography>
// </Fragment>
// ),
// },
// ]}
>
asd
</Banner>
2022-03-11 03:13:10 +01:00
</Wrapper>
</Fragment>
);