tabler-react-2 0.1.87 → 0.1.89

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -120,7 +120,6 @@ var useModal = exports.useModal = function useModal(options) {
120
120
  });
121
121
  }, []);
122
122
  var handleDecision = function handleDecision(decision) {
123
- console.log(decision);
124
123
  if (modalState.resolve) {
125
124
  modalState.resolve(decision);
126
125
  setModalState(function (prevState) {
@@ -29,7 +29,9 @@ var TablerProvider = exports.TablerProvider = function TablerProvider(_ref3) {
29
29
  _ref3$colorScheme = _ref3.colorScheme,
30
30
  colorScheme = _ref3$colorScheme === void 0 ? "light" : _ref3$colorScheme,
31
31
  _ref3$theme = _ref3.theme,
32
- themeColors = _ref3$theme === void 0 ? {} : _ref3$theme;
32
+ themeColors = _ref3$theme === void 0 ? {} : _ref3$theme,
33
+ _ref3$fallbackAnchor = _ref3.fallbackAnchor,
34
+ fallbackAnchor = _ref3$fallbackAnchor === void 0 ? true : _ref3$fallbackAnchor;
33
35
  (0, _react.useEffect)(function () {
34
36
  var script1 = document.createElement("script");
35
37
  script1.src = "https://cdn.jsdelivr.net/npm/@tabler/core@1.0.0-beta17/dist/js/tabler.min.js";
@@ -38,7 +40,7 @@ var TablerProvider = exports.TablerProvider = function TablerProvider(_ref3) {
38
40
  link.rel = "stylesheet";
39
41
  link.href = "https://cdn.jsdelivr.net/npm/@tabler/core@1.0.0-beta17/dist/css/tabler.min.css";
40
42
  var script2 = document.createElement("script");
41
- script2.textContent = "window.USE_FALLBACK_ANCHOR = true;";
43
+ script2.textContent = "window.USE_FALLBACK_ANCHOR = ".concat(fallbackAnchor, ";");
42
44
  document.head.appendChild(link);
43
45
  document.head.appendChild(script1);
44
46
  document.head.appendChild(script2);
@@ -10,13 +10,15 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default":
10
10
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
11
11
  var Steps = exports.Steps = function Steps(_ref) {
12
12
  var steps = _ref.steps,
13
- color = _ref.color,
13
+ passedColor = _ref.color,
14
+ passedVariant = _ref.variant,
14
15
  _ref$numbered = _ref.numbered,
15
16
  numbered = _ref$numbered === void 0 ? false : _ref$numbered,
16
17
  _ref$hideText = _ref.hideText,
17
18
  hideText = _ref$hideText === void 0 ? false : _ref$hideText,
18
19
  _ref$vertical = _ref.vertical,
19
20
  vertical = _ref$vertical === void 0 ? false : _ref$vertical;
21
+ var color = passedColor || passedVariant;
20
22
  var stepClass = "steps ".concat(color ? "steps-".concat(color) : "", " ").concat(numbered ? "steps-counter" : "", " ").concat(vertical ? "steps-vertical" : "");
21
23
  return /*#__PURE__*/_react["default"].createElement("ul", {
22
24
  className: stepClass
@@ -8,6 +8,11 @@ var _react = _interopRequireDefault(require("react"));
8
8
  var _propTypes = _interopRequireDefault(require("prop-types"));
9
9
  var _classnames = _interopRequireDefault(require("classnames"));
10
10
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
11
+ var i = function i(Icon) {
12
+ var isComponent = typeof Icon === "function" || /*#__PURE__*/_react["default"].isValidElement(Icon);
13
+ console.log(isComponent, typeof Icon === "function", /*#__PURE__*/_react["default"].isValidElement(Icon));
14
+ return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, isComponent ? /*#__PURE__*/_react["default"].createElement(Icon, null) : Icon);
15
+ };
11
16
  var Timeline = exports.Timeline = function Timeline(_ref) {
12
17
  var events = _ref.events,
13
18
  dense = _ref.dense;
@@ -19,7 +24,7 @@ var Timeline = exports.Timeline = function Timeline(_ref) {
19
24
  key: index
20
25
  }, /*#__PURE__*/_react["default"].createElement("div", {
21
26
  className: "timeline-event-icon ".concat(event.iconBgColor && "bg-".concat(event.iconBgColor, "-lt"), " ").concat(event.iconBgClass || "")
22
- }, event.icon && /*#__PURE__*/_react["default"].createElement(event.icon, null)), /*#__PURE__*/_react["default"].createElement("div", {
27
+ }, event.icon && i(event.icon)), /*#__PURE__*/_react["default"].createElement("div", {
23
28
  className: "card timeline-event-card ".concat(dense && "card-sm")
24
29
  }, /*#__PURE__*/_react["default"].createElement("div", {
25
30
  className: "card-body"
@@ -4,8 +4,8 @@ module.exports = {
4
4
  defaultTitle: `Tabler React 2 Docs`,
5
5
  siteTitleShort: `Tabler React 2 Docs`,
6
6
  siteDescription: `Documentation for Tabler React 2`,
7
- siteUrl: `https://rocketdocs.netlify.app`,
8
- siteAuthor: `@jpedroschmitz`,
7
+ siteUrl: `https://tabler-react-2.pages.dev`,
8
+ siteAuthor: `@jackcrane`,
9
9
  siteImage: `/banner.png`,
10
10
  siteLanguage: `en`,
11
11
  themeColor: `#066fd1`,
@@ -20,7 +20,7 @@ module.exports = {
20
20
  homePath: `src/home`,
21
21
  yamlFilesPath: `src/yamlFiles`,
22
22
  repositoryUrl: `https://github.com/jackcrane/tabler-react-2`,
23
- baseDir: `examples/gatsby-theme-docs`,
23
+ baseDir: `docs`,
24
24
  gatsbyRemarkPlugins: [],
25
25
  },
26
26
  },
package/docs/package.json CHANGED
@@ -22,7 +22,7 @@
22
22
  "react": "^18.2.0",
23
23
  "react-dom": "^18.2.0",
24
24
  "styled-components": "^6.1.15",
25
- "tabler-react-2": "0.1.86"
25
+ "tabler-react-2": "0.1.88"
26
26
  },
27
27
  "devDependencies": {},
28
28
  "keywords": [
@@ -1,12 +1,12 @@
1
1
  import React from "react";
2
2
  import { Button, useModal } from "tabler-react-2";
3
3
 
4
- export const ButtonedHookModal = ({ hookProps, on = () => {} }) => {
4
+ export const ButtonedHookModal = ({ hookProps, buttonOn, on = () => {} }) => {
5
5
  const { modal, ModalElement } = useModal(hookProps);
6
6
 
7
7
  return (
8
8
  <>
9
- <Button onClick={async () => on(await modal())}>
9
+ <Button onClick={async () => on(await modal(buttonOn))}>
10
10
  Open hook-driven modal
11
11
  </Button>
12
12
  {ModalElement}
@@ -0,0 +1,15 @@
1
+ import React from "react";
2
+ import { Button, useConfirm } from "tabler-react-2";
3
+
4
+ export const ConfirmModal = ({ on = () => {}, hookProps, buttonOn }) => {
5
+ const { confirm, ConfirmModal } = useConfirm(hookProps);
6
+
7
+ return (
8
+ <>
9
+ <Button onClick={async () => on(await confirm(buttonOn))}>
10
+ Open confirm modal
11
+ </Button>
12
+ {ConfirmModal}
13
+ </>
14
+ );
15
+ };
@@ -9,7 +9,7 @@ const _Excerpt = styled.div`
9
9
  background-size: 20px 20px;
10
10
  background-position: -19px -19px;
11
11
  border: 1.5px solid #e4e4e4;
12
- border-radius: 8px;
12
+ border-radius: 5px;
13
13
  min-height: 100px;
14
14
  width: 100%;
15
15
  padding: 16px;
@@ -18,6 +18,7 @@ const _Excerpt = styled.div`
18
18
  align-items: center;
19
19
  justify-content: center;
20
20
  margin-bottom: 16px;
21
+ overflow: auto;
21
22
  `;
22
23
 
23
24
  export const Excerpt = ({ children, f }) => {
@@ -39,6 +39,9 @@ export const Modal = loadable(() =>
39
39
  export const ButtonedHookModal = loadable(() =>
40
40
  import("./ButtonedHookModal").then((mod) => mod.ButtonedHookModal)
41
41
  );
42
+ export const ConfirmModal = loadable(() =>
43
+ import("./ConfirmModal").then((mod) => mod.ConfirmModal)
44
+ );
42
45
  export const Ribbon = loadable(() =>
43
46
  import("tabler-react-2").then((mod) => mod.Ribbon)
44
47
  );
@@ -12,6 +12,8 @@
12
12
  link: "/components/typography"
13
13
  - label: "Cards"
14
14
  link: "/components/cards"
15
+ - label: "Buttons"
16
+ link: "/components/buttons"
15
17
  - label: "Horizontal Rule"
16
18
  link: "/components/hr"
17
19
  - label: "Alerts"
@@ -20,8 +22,6 @@
20
22
  link: "/components/avatar"
21
23
  - label: "Badges"
22
24
  link: "/components/badges"
23
- - label: "Buttons"
24
- link: "/components/buttons"
25
25
  - label: "Dropdown"
26
26
  link: "/components/dropdown"
27
27
  - label: "Dropdown Input"
@@ -30,23 +30,21 @@
30
30
  link: "/components/modals"
31
31
  - label: "Hook-driven modals"
32
32
  link: "/components/hook-driven-modals"
33
+ - label: "Hook-driven confirm"
34
+ link: "/components/hook-confirm"
33
35
  - label: "Ribbons"
34
36
  link: "/components/ribbons"
35
37
  - label: "Spinners"
36
38
  link: "/components/spinners"
39
+ - label: "Steps"
40
+ link: "/components/steps"
41
+ - label: "Tables"
42
+ link: "/components/tables"
43
+ - label: "Timeline"
44
+ link: "/components/timeline"
37
45
  - label: "Utilities"
38
46
  items:
39
47
  - label: "Colors"
40
48
  link: "/utilities/colors"
41
49
  - label: "Margins"
42
50
  link: "/utilities/margins"
43
- - label: "More"
44
- items:
45
- - label: "To do list"
46
- link: "/todo"
47
- # - label: More
48
- # items:
49
- # - label: FAQ
50
- # link: /faq
51
- # - label: "Github"
52
- # link: https://github.com/jpedroschmitz/rocketdocs
@@ -0,0 +1,90 @@
1
+ [
2
+ {
3
+ "name": "Ed Case",
4
+ "email": "ed.case@mail.house.gov",
5
+ "party": "democrat",
6
+ "region": {
7
+ "state": "Hawaii",
8
+ "abbr": "HI",
9
+ "district": "1st"
10
+ },
11
+ "website": "https://case.house.gov"
12
+ },
13
+ {
14
+ "name": "Mike Carey",
15
+ "email": "mike.carey@mail.house.gov",
16
+ "party": "republican",
17
+ "region": {
18
+ "state": "Ohio",
19
+ "abbr": "OH",
20
+ "district": "15th"
21
+ },
22
+ "website": "https://carey.house.gov"
23
+ },
24
+ {
25
+ "name": "Andrew Clyde",
26
+ "email": "andrew.clyde@mail.house.gov",
27
+ "party": "republican",
28
+ "region": {
29
+ "state": "Georgia",
30
+ "abbr": "GA",
31
+ "district": "9th"
32
+ },
33
+ "website": "https://clyde.house.gov"
34
+ },
35
+ {
36
+ "name": "Angie Craig",
37
+ "email": "angie.craig@mail.house.gov",
38
+ "party": "democrat",
39
+ "region": {
40
+ "state": "Minnesota",
41
+ "abbr": "MN",
42
+ "district": "2nd"
43
+ },
44
+ "website": "https://craig.house.gov"
45
+ },
46
+ {
47
+ "name": "Rick Crawford",
48
+ "email": "rick.crawford@mail.house.gov",
49
+ "party": "republican",
50
+ "region": {
51
+ "state": "Arkansas",
52
+ "abbr": "AR",
53
+ "district": "1st"
54
+ },
55
+ "website": "https://crawford.house.gov"
56
+ },
57
+ {
58
+ "name": "Jared Golden",
59
+ "email": "jared.golden@mail.house.gov",
60
+ "party": "democrat",
61
+ "region": {
62
+ "state": "Maine",
63
+ "abbr": "ME",
64
+ "district": "2nd"
65
+ },
66
+ "website": "https://golden.house.gov"
67
+ },
68
+ {
69
+ "name": "Dusty Johnson",
70
+ "email": "dusty.johnson@mail.house.gov",
71
+ "party": "republican",
72
+ "region": {
73
+ "state": "South Dakota",
74
+ "abbr": "SD",
75
+ "district": "At-Large"
76
+ },
77
+ "website": "https://dustyjohnson.house.gov"
78
+ },
79
+ {
80
+ "name": "Susie Lee",
81
+ "email": "susie.lee@mail.house.gov",
82
+ "party": "democrat",
83
+ "region": {
84
+ "state": "Nevada",
85
+ "abbr": "NV",
86
+ "district": "3rd"
87
+ },
88
+ "website": "https://susielee.house.gov"
89
+ }
90
+ ]
@@ -12,7 +12,7 @@ Buttons are used to trigger actions.
12
12
  ```jsx
13
13
  import { Button } from "tabler-react-2";
14
14
 
15
- <ButtonButton {...props} />;
15
+ <Button {...props} />;
16
16
  ```
17
17
 
18
18
  ### Props
@@ -0,0 +1,106 @@
1
+ ---
2
+ title: Hook-driven confirm
3
+ ---
4
+
5
+ import { ConfirmModal } from "../../components/LoadableTabler.jsx";
6
+ import { Excerpt } from "../../components/Excerpt.jsx";
7
+
8
+ Hook-driven confirms are used to display content in a layer above the main content. They can be used to display forms, confirmations, or other types of content.
9
+
10
+ The hook will provide a `confirm` function that returns a promise. The promise will resolve with the value of the button clicked, or `false` if the modal is closed without a button click. It will also return a `<ConfirmModal />` component that you need to render in your application.
11
+
12
+ If the user clicks the cancel button, the promise will resolve with `false`, functionally the same as if the user clicked cancel.
13
+
14
+ ## Signature
15
+
16
+ ```jsx
17
+ import { useConfirm } from "tabler-react-2";
18
+
19
+ const { confirm, ConfirmModal } = useConfirm({
20
+ title: "Confirm Title",
21
+ text: "Text",
22
+ commitText: "Commit",
23
+ cancelText: "Cancel",
24
+ });
25
+
26
+ <ConfirmModal />
27
+ <Button onClick={() => confirm()}>Open hook-driven confirm</Button>
28
+ ```
29
+
30
+ ### Props
31
+
32
+ | Prop | Required | Type | Default | Description |
33
+ | ------------ | -------- | -------------- | ------- | ------------------------------------- |
34
+ | `title` | No | String | | The title of the modal. |
35
+ | `text` | No | String \| node | | The text of the modal. |
36
+ | `commitText` | No | String | | The text of the commit button. |
37
+ | `cancelText` | No | String | | The text of the cancel button. |
38
+ | `modalProps` | No | Object | | Additional props to pass to the modal |
39
+
40
+ <blockquote>
41
+ <p>
42
+
43
+ **Tip**: If you need to use multiple hook driven confirms in a single scope or want to descriptively name the confirm variables you can re-assign the variable names in the deconstruction:
44
+
45
+ ```jsx
46
+ const Home = () => {
47
+ const { confirm: signup, ConfirmModal: SignupPopup } = useConfirm({
48
+ title: "Confirm Title",
49
+ text: "Text",
50
+ commitText: "Commit",
51
+ cancelText: "Cancel",
52
+ });
53
+
54
+ return (
55
+ <>
56
+ <Button onClick={() => signup()}>Open hook-driven confirm</Button>
57
+ {SignupPopup}
58
+ </>
59
+ );
60
+ };
61
+ ```
62
+
63
+ </p>
64
+ </blockquote>
65
+
66
+ > **Note**: You don't need to use a `<Button />` component to open the confirm. The `confirm()` function is in scope and can be called directly or any other way you would typically call a function.
67
+
68
+ ## Basic Usage
69
+
70
+ The `useConfirm` hook is used to display a confirm.
71
+
72
+ <Excerpt>
73
+ <ConfirmModal
74
+ on={(d) => window && window.alert(d)}
75
+ hookProps={{
76
+ title: "Confirm Title",
77
+ text: <kbd>A hook-driven confirm.</kbd>,
78
+ commitText: "Commit",
79
+ cancelText: "Cancel",
80
+ }}
81
+ />
82
+ </Excerpt>
83
+
84
+ For the basic usage, this shows the entire component, not just the implementation like usual. This is because of the extra implementation steps.
85
+
86
+ ```jsx title="./index.jsx"
87
+ import { useConfirm, Button } from "tabler-react-2";
88
+
89
+ const Home = () => {
90
+ const { confirm, ConfirmModal } = useConfirm({
91
+ title: "Confirm Title",
92
+ text: "Text",
93
+ commitText: "Commit",
94
+ cancelText: "Cancel",
95
+ });
96
+
97
+ return (
98
+ <>
99
+ <Button onClick={async () => alert(await confirm())}>
100
+ Open hook-driven confirm
101
+ </Button>
102
+ {ConfirmModal}
103
+ </>
104
+ );
105
+ };
106
+ ```
@@ -7,6 +7,8 @@ import { Excerpt } from "../../components/Excerpt.jsx";
7
7
 
8
8
  Hook-driven modals are used to display content in a layer above the main content. They can be used to display forms, confirmations, or other types of content.
9
9
 
10
+ The hook will provide a `modal` function that returns a promise. The promise will resolve with the value of the button clicked, or `false` if the modal is closed without a button click. It will also return a `<ModalElement />` component that you need to render in your application.
11
+
10
12
  ## Signature
11
13
 
12
14
  ```jsx
@@ -27,10 +29,37 @@ const { modal, ModalElement } = useModal({
27
29
  | Prop | Required | Type | Default | Description |
28
30
  | ------------ | -------- | ------------------------- | ------- | ------------------------------------- |
29
31
  | `title` | No | String | | The title of the modal. |
30
- | `text` | No | String | | The text of the modal. |
32
+ | `text` | No | String \| node | | The text of the modal. |
31
33
  | `buttons` | No | [ButtonList](#buttonlist) | | An array of buttons to display |
32
34
  | `modalProps` | No | Object | | Additional props to pass to the modal |
33
35
 
36
+ <blockquote>
37
+ <p>
38
+
39
+ **Tip**: If you need to use multiple hook driven modals in a single scope or want to descriptively name the modal variables you can re-assign the variable names in the deconstruction:
40
+
41
+ ```jsx
42
+ const Home = () => {
43
+ const { modal: signup, ModalElement: SignupPopup } = useModal({
44
+ title: "Modal Title",
45
+ text: "Text",
46
+ buttons: [],
47
+ });
48
+
49
+ return (
50
+ <>
51
+ <Button onClick={() => signup()}>Open hook-driven modal</Button>
52
+ {SignupPopup}
53
+ </>
54
+ );
55
+ };
56
+ ```
57
+
58
+ </p>
59
+ </blockquote>
60
+
61
+ > **Note**: You don't need to use a `<Button />` component to open the modal. The `modal()` function is in scope and can be called directly or any other way you would typically call a function.
62
+
34
63
  ## Basic Usage
35
64
 
36
65
  The `useModal` hook is used to display a modal.
@@ -41,6 +70,118 @@ The `useModal` hook is used to display a modal.
41
70
  hookProps={{
42
71
  title: "Modal Title",
43
72
  text: <kbd>A hook-driven modal.</kbd>,
73
+ }}
74
+ />
75
+ </Excerpt>
76
+
77
+ For the basic usage, this shows the entire component, not just the implementation like usual. This is because of the extra implementation steps.
78
+
79
+ ```jsx title="./index.jsx"
80
+ import { useModal, Button } from "tabler-react-2";
81
+
82
+ const Home = () => {
83
+ const { modal, ModalElement } = useModal({
84
+ title: "Modal Title",
85
+ text: "Text",
86
+ });
87
+
88
+ return (
89
+ <>
90
+ <Button onClick={() => modal()}>Open hook-driven modal</Button>
91
+ {ModalElement}
92
+ </>
93
+ );
94
+ };
95
+
96
+ export default Home;
97
+ ```
98
+
99
+ ## Buttons
100
+
101
+ You can pass [`ButtonList`](#buttonlist) to the `buttons` prop to display buttons in the modal footer. When the button is clicked, the modal will close and the promise returned by the `modal` function will resolve with the value of the clicked button.
102
+
103
+ <Excerpt f>
104
+ <ButtonedHookModal
105
+ on={(d) => alert(d)}
106
+ hookProps={{
107
+ title: "Modal Title",
108
+ text: <kbd>A hook-driven modal with buttons.</kbd>,
109
+ buttons: [
110
+ {
111
+ text: "Button 1",
112
+ variant: "danger",
113
+ value: "one",
114
+ },
115
+ {
116
+ text: "Button 2",
117
+ variant: "success",
118
+ value: "two",
119
+ },
120
+ ],
121
+ }}
122
+ />
123
+ </Excerpt>
124
+
125
+ ```jsx
126
+ const Home = () => {
127
+ const {} = useModal({
128
+ title: "Modal Title",
129
+ text: "Text",
130
+ buttons: [
131
+ {
132
+ text: "Button 1",
133
+ variant: "danger",
134
+ value: "one",
135
+ },
136
+ {
137
+ text: "Button 2",
138
+ variant: "success",
139
+ value: "two",
140
+ },
141
+ ],
142
+ });
143
+
144
+ return (
145
+ <>
146
+ <Button onClick={async () => alert(await modal())}>
147
+ Open hook-driven modal
148
+ </Button>
149
+ {ModalElement}
150
+ </>
151
+ );
152
+ };
153
+ ```
154
+
155
+ ### ButtonList
156
+
157
+ The `buttons` prop of the `useModal` hook accepts an array of objects.
158
+
159
+ A `button` object has the following properties:
160
+
161
+ | Prop | Required | Type | Default | Description |
162
+ | --------- | -------- | ------ | ------- | ----------------------------------------------- |
163
+ | `text` | Yes | String | | The text to display in the button. |
164
+ | `variant` | No | String | | The color variant of the button. |
165
+ | `value` | No | Any | | The value to return when the button is clicked. |
166
+
167
+ ```ts
168
+ type ButtonList = Array<{
169
+ text: string;
170
+ variant?: string;
171
+ value?: any;
172
+ }
173
+ ```
174
+
175
+ ## Overriding modal setup
176
+
177
+ You can pass an object to the `modal()` function to override the default modal setup:
178
+
179
+ <Excerpt f>
180
+ <ButtonedHookModal
181
+ on={(d) => alert(d)}
182
+ hookProps={{
183
+ title: "This not show up",
184
+ text: <kbd>A hook-driven modal with buttons.</kbd>,
44
185
  buttons: [
45
186
  {
46
187
  text: "Button 1",
@@ -54,5 +195,25 @@ The `useModal` hook is used to display a modal.
54
195
  },
55
196
  ],
56
197
  }}
198
+ buttonOn={{ title: "This will though!" }}
57
199
  />
58
200
  </Excerpt>
201
+
202
+ ```jsx
203
+ const Home = () => {
204
+ const { modal, ModalElement } = useModal({
205
+ title: "This will not show up",
206
+ text: "Text",
207
+ buttons: [],
208
+ });
209
+
210
+ return (
211
+ <>
212
+ <Button onClick={() => modal({ title: "This will though!" })}>
213
+ Open hook-driven modal
214
+ </Button>
215
+ {ModalElement}
216
+ </>
217
+ );
218
+ };
219
+ ```
@@ -113,13 +113,13 @@ You can pass [`ButtonList`](#buttonlist) to the `buttons` prop to display button
113
113
  text: "Button 1",
114
114
  variant: "danger",
115
115
  attrs: { outline: true },
116
- onClick: () => alert("Clicked button 1"),
116
+ onClick: () => window && window.alert("Clicked button 1"),
117
117
  },
118
118
  {
119
119
  text: "Button 2",
120
120
  variant: "success",
121
121
  attrs: { outline: true },
122
- onClick: () => alert("Clicked button 2"),
122
+ onClick: () => window && window.alert("Clicked button 2"),
123
123
  },
124
124
  ]}
125
125
  >