summaryrefslogtreecommitdiff
path: root/packages/taler-wallet-webextension/src/components/Banner.stories.tsx
blob: 4d328a72398bedb57657f3e766fd2b5e5f7cf03d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
/*
 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, h, VNode } from "preact";
import { Avatar } from "../mui/Avatar.js";
import { Typography } from "../mui/Typography.js";
import { Banner } from "./Banner.js";
import { SvgIcon } from "./styled/index.js";
import wifiIcon from "../svg/wifi.svg";
export default {
  title: "mui/banner",
  component: Banner,
};

function Wrapper({ children }: any): VNode {
  return (
    <div
      style={{
        display: "flex",
        backgroundColor: "lightgray",
        padding: 10,
        width: "100%",
        // width: 400,
        // height: 400,
        justifyContent: "center",
      }}
    >
      <div style={{ flexGrow: 1 }}>{children}</div>
    </div>
  );
}
function SignalWifiOffIcon({ ...rest }: any): VNode {
  return <SvgIcon {...rest} dangerouslySetInnerHTML={{ __html: wifiIcon }} />;
}

export const BasicExample = (): VNode => (
  <Fragment>
    <Wrapper>
      <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
        elements={[
          {
            icon: <SignalWifiOffIcon color="gray" />,
            description: (
              <Typography>
                You have lost connection to the internet. This app is offline.
              </Typography>
            ),
          },
        ]}
        confirm={{
          label: "turn on wifi",
          action: () => {
            return null;
          },
        }}
      />
    </Wrapper>
  </Fragment>
);

export const PendingOperation = (): VNode => (
  <Fragment>
    <Wrapper>
      <Banner
        title="PENDING TRANSACTIONS"
        style={{ backgroundColor: "lightcyan", padding: 8 }}
        elements={[
          {
            icon: (
              <Avatar
                style={{
                  border: "solid blue 1px",
                  color: "blue",
                  boxSizing: "border-box",
                }}
              >
                P
              </Avatar>
            ),
            description: (
              <Typography>
                <b>EUR 37.95</b> - 5 feb 2022
              </Typography>
            ),
          },
        ]}
      />
    </Wrapper>
  </Fragment>
);