@automattic/jetpack-components 0.41.2 → 0.42.1

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.
Files changed (99) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/components/boost-score-graph/background.tsx +183 -0
  3. package/components/boost-score-graph/index.tsx +24 -16
  4. package/components/boost-score-graph/style.scss +17 -0
  5. package/components/boost-score-graph/types/declarations.d.ts +4 -0
  6. package/components/boost-score-graph/uplot-line-chart.tsx +11 -5
  7. package/components/boost-score-graph/use-boost-score-transform.ts +21 -18
  8. package/components/gridicon/index.tsx +13 -0
  9. package/components/{pricing-slider → number-slider}/index.tsx +12 -12
  10. package/components/{pricing-slider → number-slider}/style.scss +8 -8
  11. package/components/{pricing-slider → number-slider}/types.ts +2 -2
  12. package/components/popover/index.tsx +19 -0
  13. package/components/popover/style.scss +25 -0
  14. package/index.ts +2 -1
  15. package/package.json +12 -12
  16. package/.gitattributes +0 -8
  17. package/components/action-button/stories/index.stories.jsx +0 -38
  18. package/components/action-button/test/component.jsx +0 -16
  19. package/components/action-popover/stories/index.stories.jsx +0 -115
  20. package/components/action-popover/stories/styles.module.scss +0 -7
  21. package/components/admin-page/stories/index.stories.tsx +0 -35
  22. package/components/admin-page/stories/style.module.scss +0 -13
  23. package/components/admin-section/stories/index.stories.tsx +0 -60
  24. package/components/alert/stories/index.stories.jsx +0 -24
  25. package/components/automattic-byline-logo/stories/index.stories.tsx +0 -20
  26. package/components/automattic-byline-logo/test/component.tsx +0 -28
  27. package/components/boost-score-bar/stories/index.stories.tsx +0 -39
  28. package/components/boost-score-bar/test/component.tsx +0 -102
  29. package/components/boost-score-graph/stories/index.stories.tsx +0 -187
  30. package/components/boost-score-graph/stories/tooltip.stories.tsx +0 -41
  31. package/components/button/stories/index.mdx +0 -90
  32. package/components/button/stories/index.stories.tsx +0 -400
  33. package/components/button/stories/style.module.scss +0 -20
  34. package/components/contextual-upgrade-trigger/stories/index.stories.tsx +0 -25
  35. package/components/decorative-card/stories/index.stories.tsx +0 -18
  36. package/components/dialog/stories/boost.png +0 -0
  37. package/components/dialog/stories/declaration.d.ts +0 -1
  38. package/components/dialog/stories/index.stories.tsx +0 -118
  39. package/components/dialog/stories/js-components.components.dialog.mdx +0 -62
  40. package/components/dialog/stories/js-components.components.dialog.stories.js +0 -37
  41. package/components/dialog/stories/style.module.scss +0 -21
  42. package/components/donut-meter/stories/index.stories.tsx +0 -51
  43. package/components/donut-meter/test/component.tsx +0 -24
  44. package/components/gridicon/stories/index.stories.tsx +0 -18
  45. package/components/icon-tooltip/stories/index.stories.tsx +0 -108
  46. package/components/icon-tooltip/stories/style.scss +0 -36
  47. package/components/icon-tooltip/test/component.tsx +0 -15
  48. package/components/icons/stories/index.stories.tsx +0 -65
  49. package/components/icons/stories/style.module.scss +0 -33
  50. package/components/indeterminate-progress-bar/stories/index.stories.tsx +0 -14
  51. package/components/jetpack-footer/stories/index.stories.tsx +0 -39
  52. package/components/jetpack-footer/test/__snapshots__/component.tsx.snap +0 -186
  53. package/components/jetpack-footer/test/component.tsx +0 -159
  54. package/components/jetpack-logo/stories/index.stories.tsx +0 -20
  55. package/components/jetpack-logo/test/component.tsx +0 -16
  56. package/components/jetpack-search-logo/stories/index.stories.tsx +0 -21
  57. package/components/jetpack-search-logo/test/component.tsx +0 -16
  58. package/components/jetpack-vaultpress-backup-logo/stories/index.stories.tsx +0 -20
  59. package/components/jetpack-vaultpress-backup-logo/test/component.tsx +0 -18
  60. package/components/jetpack-videopress-logo/stories/index.stories.tsx +0 -20
  61. package/components/jetpack-videopress-logo/test/component.tsx +0 -16
  62. package/components/layout/stories/index.stories.tsx +0 -145
  63. package/components/layout/stories/styles.module.scss +0 -22
  64. package/components/loading-placeholder/stories/index.stories.tsx +0 -78
  65. package/components/notice/stories/index.stories.jsx +0 -90
  66. package/components/pricing-card/stories/index.stories.tsx +0 -55
  67. package/components/pricing-card/test/component.tsx +0 -89
  68. package/components/pricing-slider/stories/index.stories.tsx +0 -44
  69. package/components/pricing-slider/test/component.tsx +0 -14
  70. package/components/pricing-table/stories/index.stories.tsx +0 -74
  71. package/components/pricing-table/test/component.tsx +0 -41
  72. package/components/product-offer/stories/index.stories.tsx +0 -104
  73. package/components/product-price/stories/index.stories.tsx +0 -33
  74. package/components/product-price/test/component.tsx +0 -26
  75. package/components/qr-code/stories/index.stories.tsx +0 -32
  76. package/components/record-meter-bar/stories/index.stories.tsx +0 -39
  77. package/components/record-meter-bar/test/component.tsx +0 -52
  78. package/components/spinner/stories/index.stories.jsx +0 -20
  79. package/components/spinner/test/component.jsx +0 -17
  80. package/components/split-button/stories/index.stories.tsx +0 -35
  81. package/components/stat-card/stories/index.mdx +0 -35
  82. package/components/stat-card/stories/index.stories.tsx +0 -41
  83. package/components/stat-card/test/component.tsx +0 -24
  84. package/components/status/stories/index.stories.tsx +0 -44
  85. package/components/terms-of-service/test/index.test.jsx +0 -52
  86. package/components/testimonials/test/component.tsx +0 -103
  87. package/components/text/stories/headings.index.stories.tsx +0 -80
  88. package/components/text/stories/index.mdx +0 -195
  89. package/components/text/stories/index.stories.tsx +0 -69
  90. package/components/text/stories/style.module.scss +0 -64
  91. package/components/text/stories/title.index.stories.tsx +0 -34
  92. package/components/theme-provider/stories/index.stories.tsx +0 -164
  93. package/components/theme-provider/stories/style.module.scss +0 -79
  94. package/components/toggle-control/stories/index.stories.tsx +0 -83
  95. package/components/zendesk-chat/stories/index.stories.tsx +0 -15
  96. package/components/zendesk-chat/test/component.tsx +0 -16
  97. package/lib/locale/test/index.ts +0 -21
  98. package/tools/jp-redirect/test/index.tsx +0 -89
  99. package/tools/pricing-utils/test/index.ts +0 -39
@@ -1,39 +0,0 @@
1
- import JetpackFooter from '../index';
2
- import type { ComponentStory, ComponentMeta } from '@storybook/react';
3
-
4
- export default {
5
- title: 'JS Packages/Components/Jetpack Footer',
6
- component: JetpackFooter,
7
- } as ComponentMeta< typeof JetpackFooter >;
8
-
9
- const Template: ComponentStory< typeof JetpackFooter > = args => <JetpackFooter { ...args } />;
10
-
11
- const DefaultArgs = {
12
- moduleName: 'Jetpack',
13
- className: '',
14
- moduleNameHref: 'https://jetpack.com',
15
- };
16
-
17
- export const _default = Template.bind( {} );
18
- _default.args = DefaultArgs;
19
-
20
- export const WithMenu = Template.bind( {} );
21
- WithMenu.args = {
22
- ...DefaultArgs,
23
- menu: [
24
- {
25
- label: 'Menu Item',
26
- href: '#',
27
- },
28
- {
29
- label: 'External Menu Item',
30
- href: '#',
31
- target: '_blank',
32
- },
33
- {
34
- label: 'Menu Item With Title',
35
- title: 'Hello, World!',
36
- href: '#',
37
- },
38
- ],
39
- };
@@ -1,186 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`JetpackFooter Render the component should match the snapshot: all props 1`] = `
4
- <div>
5
- <footer
6
- aria-label="Jetpack"
7
- class="jp-dashboard-footer sample-classname"
8
- >
9
- <ul>
10
- <li
11
- class="jp-dashboard-footer__jp-item"
12
- >
13
- <a
14
- href="https://jetpack.com/path/to-some-page"
15
- >
16
- <svg
17
- aria-hidden="true"
18
- aria-labelledby="jetpack-logo-title"
19
- class="jetpack-logo"
20
- height="16"
21
- viewBox="0 0 32 32"
22
- x="0px"
23
- xmlns="http://www.w3.org/2000/svg"
24
- y="0px"
25
- >
26
- <desc
27
- id="jetpack-logo-title"
28
- >
29
- Jetpack Logo
30
- </desc>
31
- <path
32
- d="M16,0C7.2,0,0,7.2,0,16s7.2,16,16,16s16-7.2,16-16S24.8,0,16,0z M15,19H7l8-16V19z M17,29V13h8L17,29z"
33
- fill="#000"
34
- />
35
- </svg>
36
- Test module
37
- </a>
38
- </li>
39
- <li>
40
- <a
41
- class="jp-dashboard-footer__menu-item is-external"
42
- href="https://jetpack.com/redirect/?source=jetpack-about"
43
- rel="noopener noreferrer"
44
- target="_blank"
45
- title="About Jetpack"
46
- >
47
- About
48
- <svg
49
- aria-hidden="true"
50
- focusable="false"
51
- height="16"
52
- viewBox="0 0 24 24"
53
- width="16"
54
- xmlns="http://www.w3.org/2000/svg"
55
- >
56
- <path
57
- d="M19.5 4.5h-7V6h4.44l-5.97 5.97 1.06 1.06L18 7.06v4.44h1.5v-7Zm-13 1a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-3H17v3a.5.5 0 0 1-.5.5h-10a.5.5 0 0 1-.5-.5v-10a.5.5 0 0 1 .5-.5h3V5.5h-3Z"
58
- />
59
- </svg>
60
- </a>
61
- </li>
62
- <li>
63
- <a
64
- class="jp-dashboard-footer__menu-item is-external"
65
- href="https://jetpack.com/redirect/?source=a8c-privacy"
66
- rel="noopener noreferrer"
67
- target="_blank"
68
- title="Automattic's Privacy Policy"
69
- >
70
- Privacy
71
- <svg
72
- aria-hidden="true"
73
- focusable="false"
74
- height="16"
75
- viewBox="0 0 24 24"
76
- width="16"
77
- xmlns="http://www.w3.org/2000/svg"
78
- >
79
- <path
80
- d="M19.5 4.5h-7V6h4.44l-5.97 5.97 1.06 1.06L18 7.06v4.44h1.5v-7Zm-13 1a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-3H17v3a.5.5 0 0 1-.5.5h-10a.5.5 0 0 1-.5-.5v-10a.5.5 0 0 1 .5-.5h3V5.5h-3Z"
81
- />
82
- </svg>
83
- </a>
84
- </li>
85
- <li>
86
- <a
87
- class="jp-dashboard-footer__menu-item is-external"
88
- href="https://jetpack.com/redirect/?source=wpcom-tos"
89
- rel="noopener noreferrer"
90
- target="_blank"
91
- title="WordPress.com Terms of Service"
92
- >
93
- Terms
94
- <svg
95
- aria-hidden="true"
96
- focusable="false"
97
- height="16"
98
- viewBox="0 0 24 24"
99
- width="16"
100
- xmlns="http://www.w3.org/2000/svg"
101
- >
102
- <path
103
- d="M19.5 4.5h-7V6h4.44l-5.97 5.97 1.06 1.06L18 7.06v4.44h1.5v-7Zm-13 1a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-3H17v3a.5.5 0 0 1-.5.5h-10a.5.5 0 0 1-.5-.5v-10a.5.5 0 0 1 .5-.5h3V5.5h-3Z"
104
- />
105
- </svg>
106
- </a>
107
- </li>
108
- <li>
109
- <a
110
- class="jp-dashboard-footer__menu-item"
111
- href="/"
112
- >
113
- Link
114
- </a>
115
- </li>
116
- <li>
117
- <a
118
- class="jp-dashboard-footer__menu-item is-external"
119
- href="/"
120
- rel="noopener noreferrer"
121
- target="_blank"
122
- >
123
- External link
124
- <svg
125
- aria-hidden="true"
126
- focusable="false"
127
- height="16"
128
- viewBox="0 0 24 24"
129
- width="16"
130
- xmlns="http://www.w3.org/2000/svg"
131
- >
132
- <path
133
- d="M19.5 4.5h-7V6h4.44l-5.97 5.97 1.06 1.06L18 7.06v4.44h1.5v-7Zm-13 1a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-3H17v3a.5.5 0 0 1-.5.5h-10a.5.5 0 0 1-.5-.5v-10a.5.5 0 0 1 .5-.5h3V5.5h-3Z"
134
- />
135
- </svg>
136
- </a>
137
- </li>
138
- <li>
139
- <a
140
- class="jp-dashboard-footer__menu-item"
141
- href="/"
142
- role="button"
143
- tabindex="0"
144
- >
145
- Button link
146
- </a>
147
- </li>
148
- <li
149
- class="jp-dashboard-footer__a8c-item"
150
- >
151
- <a
152
- aria-label="An Automattic Airline"
153
- href="https://jetpack.com/redirect/?source=a8c-about"
154
- >
155
- <svg
156
- aria-hidden="true"
157
- aria-labelledby="jp-automattic-byline-logo-title"
158
- class="jp-automattic-byline-logo"
159
- enable-background="new 0 0 935 38.2"
160
- height="7"
161
- role="img"
162
- viewBox="0 0 935 38.2"
163
- x="0"
164
- y="0"
165
- >
166
- <desc
167
- id="jp-automattic-byline-logo-title"
168
- >
169
- An Automattic Airline
170
- </desc>
171
- <path
172
- d="M317.1 38.2c-12.6 0-20.7-9.1-20.7-18.5v-1.2c0-9.6 8.2-18.5 20.7-18.5 12.6 0 20.8 8.9 20.8 18.5v1.2C337.9 29.1 329.7 38.2 317.1 38.2zM331.2 18.6c0-6.9-5-13-14.1-13s-14 6.1-14 13v0.9c0 6.9 5 13.1 14 13.1s14.1-6.2 14.1-13.1V18.6zM175 36.8l-4.7-8.8h-20.9l-4.5 8.8h-7L157 1.3h5.5L182 36.8H175zM159.7 8.2L152 23.1h15.7L159.7 8.2zM212.4 38.2c-12.7 0-18.7-6.9-18.7-16.2V1.3h6.6v20.9c0 6.6 4.3 10.5 12.5 10.5 8.4 0 11.9-3.9 11.9-10.5V1.3h6.7V22C231.4 30.8 225.8 38.2 212.4 38.2zM268.6 6.8v30h-6.7v-30h-15.5V1.3h37.7v5.5H268.6zM397.3 36.8V8.7l-1.8 3.1 -14.9 25h-3.3l-14.7-25 -1.8-3.1v28.1h-6.5V1.3h9.2l14 24.4 1.7 3 1.7-3 13.9-24.4h9.1v35.5H397.3zM454.4 36.8l-4.7-8.8h-20.9l-4.5 8.8h-7l19.2-35.5h5.5l19.5 35.5H454.4zM439.1 8.2l-7.7 14.9h15.7L439.1 8.2zM488.4 6.8v30h-6.7v-30h-15.5V1.3h37.7v5.5H488.4zM537.3 6.8v30h-6.7v-30h-15.5V1.3h37.7v5.5H537.3zM569.3 36.8V4.6c2.7 0 3.7-1.4 3.7-3.4h2.8v35.5L569.3 36.8 569.3 36.8zM628 11.3c-3.2-2.9-7.9-5.7-14.2-5.7 -9.5 0-14.8 6.5-14.8 13.3v0.7c0 6.7 5.4 13 15.3 13 5.9 0 10.8-2.8 13.9-5.7l4 4.2c-3.9 3.8-10.5 7.1-18.3 7.1 -13.4 0-21.6-8.7-21.6-18.3v-1.2c0-9.6 8.9-18.7 21.9-18.7 7.5 0 14.3 3.1 18 7.1L628 11.3zM321.5 12.4c1.2 0.8 1.5 2.4 0.8 3.6l-6.1 9.4c-0.8 1.2-2.4 1.6-3.6 0.8l0 0c-1.2-0.8-1.5-2.4-0.8-3.6l6.1-9.4C318.7 11.9 320.3 11.6 321.5 12.4L321.5 12.4z"
173
- />
174
- <path
175
- d="M37.5 36.7l-4.7-8.9H11.7l-4.6 8.9H0L19.4 0.8H25l19.7 35.9H37.5zM22 7.8l-7.8 15.1h15.9L22 7.8zM82.8 36.7l-23.3-24 -2.3-2.5v26.6h-6.7v-36H57l22.6 24 2.3 2.6V0.8h6.7v35.9H82.8z"
176
- />
177
- <path
178
- d="M719.9 37l-4.8-8.9H694l-4.6 8.9h-7.1l19.5-36h5.6l19.8 36H719.9zM704.4 8l-7.8 15.1h15.9L704.4 8zM733 37V1h6.8v36H733zM781 37c-1.8 0-2.6-2.5-2.9-5.8l-0.2-3.7c-0.2-3.6-1.7-5.1-8.4-5.1h-12.8V37H750V1h19.6c10.8 0 15.7 4.3 15.7 9.9 0 3.9-2 7.7-9 9 7 0.5 8.5 3.7 8.6 7.9l0.1 3c0.1 2.5 0.5 4.3 2.2 6.1V37H781zM778.5 11.8c0-2.6-2.1-5.1-7.9-5.1h-13.8v10.8h14.4c5 0 7.3-2.4 7.3-5.2V11.8zM794.8 37V1h6.8v30.4h28.2V37H794.8zM836.7 37V1h6.8v36H836.7zM886.2 37l-23.4-24.1 -2.3-2.5V37h-6.8V1h6.5l22.7 24.1 2.3 2.6V1h6.8v36H886.2zM902.3 37V1H935v5.6h-26v9.2h20v5.5h-20v10.1h26V37H902.3z"
179
- />
180
- </svg>
181
- </a>
182
- </li>
183
- </ul>
184
- </footer>
185
- </div>
186
- `;
@@ -1,159 +0,0 @@
1
- import { jest } from '@jest/globals';
2
- import { render, screen } from '@testing-library/react';
3
- import userEvent from '@testing-library/user-event';
4
- import JetpackFooter from '../index';
5
-
6
- describe( 'JetpackFooter', () => {
7
- const className = 'sample-classname';
8
- const moduleName = 'Test module';
9
- const moduleNameHref = 'https://jetpack.com/path/to-some-page';
10
-
11
- describe( 'Render the component', () => {
12
- const menu = [
13
- {
14
- label: 'Link',
15
- href: '/',
16
- },
17
- {
18
- label: 'External link',
19
- href: '/',
20
- target: '_blank',
21
- },
22
- {
23
- label: 'Button link',
24
- href: '/',
25
- role: 'button',
26
- },
27
- ];
28
-
29
- it( 'should include a footer tag', () => {
30
- render( <JetpackFooter /> );
31
-
32
- const element = screen.getByRole( 'contentinfo', { name: 'Jetpack' } );
33
-
34
- expect( element ).toBeInTheDocument();
35
- } );
36
-
37
- it( 'should apply the class name', () => {
38
- render( <JetpackFooter className={ className } /> );
39
-
40
- const element = screen.getByRole( 'contentinfo' );
41
-
42
- expect( element ).toHaveClass( className );
43
- } );
44
-
45
- it( 'should render the Jetpack logo', () => {
46
- render( <JetpackFooter /> );
47
-
48
- const element = screen.getByLabelText( 'Jetpack' );
49
-
50
- expect( element ).toBeInTheDocument();
51
- } );
52
-
53
- it( 'should render the module name as a link', () => {
54
- render( <JetpackFooter moduleName={ moduleName } moduleNameHref={ moduleNameHref } /> );
55
-
56
- const element = screen.getByText( moduleName );
57
-
58
- expect( element ).toBeInTheDocument();
59
- expect( element ).toBeInstanceOf( HTMLAnchorElement );
60
- expect( element ).toHaveAttribute( 'href', moduleNameHref );
61
- } );
62
-
63
- it( 'should render the module name as regular text', () => {
64
- render( <JetpackFooter moduleName={ moduleName } moduleNameHref={ null } /> );
65
-
66
- const element = screen.getByText( moduleName );
67
-
68
- expect( element ).toBeInTheDocument();
69
- expect( element ).not.toBeInstanceOf( HTMLAnchorElement );
70
- } );
71
-
72
- it( 'should render the Automattic logo', () => {
73
- render( <JetpackFooter /> );
74
-
75
- const element = screen.getByLabelText( 'An Automattic Airline', { selector: 'a' } );
76
-
77
- expect( element ).toBeInTheDocument();
78
- } );
79
-
80
- it( 'should render a list', () => {
81
- render( <JetpackFooter menu={ menu } /> );
82
-
83
- const element = screen.getByRole( 'list' );
84
-
85
- expect( element ).toBeInTheDocument();
86
- // eslint-disable-next-line testing-library/no-node-access
87
- expect( element.children ).toHaveLength( 2 + 3 + menu.length ); // 2 logos, 3 generic links
88
- } );
89
-
90
- it( 'should render the links', () => {
91
- render( <JetpackFooter menu={ menu } /> );
92
-
93
- const link = screen.getByRole( 'link', { name: menu[ 0 ].label } );
94
- const externalLink = screen.getByRole( 'link', { name: menu[ 1 ].label } );
95
- const button = screen.getByRole( 'button', { name: menu[ 2 ].label } );
96
-
97
- expect( link ).toBeInTheDocument();
98
-
99
- expect( externalLink ).toBeInTheDocument();
100
- expect( externalLink ).toHaveAttribute( 'target', '_blank' );
101
- expect( externalLink ).toHaveAttribute( 'rel', 'noopener noreferrer' );
102
- expect( externalLink ).toContainHTML( 'svg' );
103
-
104
- expect( button ).toBeInTheDocument();
105
- expect( button ).toHaveAttribute( 'tabindex', '0' );
106
- } );
107
-
108
- it( 'should match the snapshot', () => {
109
- const { container } = render(
110
- <JetpackFooter
111
- className={ className }
112
- moduleName={ moduleName }
113
- moduleNameHref={ moduleNameHref }
114
- menu={ menu }
115
- />
116
- );
117
- expect( container ).toMatchSnapshot( 'all props' );
118
- } );
119
- } );
120
-
121
- describe( 'Fire events', () => {
122
- const onClick = jest.fn();
123
- const onKeyDown = jest.fn();
124
- const menu = [
125
- {
126
- label: 'Link',
127
- href: '/',
128
- onClick,
129
- onKeyDown,
130
- },
131
- ];
132
-
133
- it( 'should call the menu item onClick function', async () => {
134
- const user = userEvent.setup();
135
-
136
- render( <JetpackFooter menu={ menu } /> );
137
-
138
- const element = screen.getByRole( 'link', { name: menu[ 0 ].label } );
139
-
140
- await user.click( element );
141
-
142
- expect( onClick ).toHaveBeenCalled();
143
- } );
144
-
145
- it( 'should call the menu item onKeyDown function', async () => {
146
- const user = userEvent.setup();
147
-
148
- render( <JetpackFooter menu={ menu } /> );
149
-
150
- const element = screen.getByRole( 'link', { name: menu[ 0 ].label } );
151
-
152
- // Need to focus on element first
153
- await user.click( element );
154
- await user.keyboard( '[Enter]' );
155
-
156
- expect( onKeyDown ).toHaveBeenCalled();
157
- } );
158
- } );
159
- } );
@@ -1,20 +0,0 @@
1
- import JetpackLogo from '../index';
2
- import type { ComponentStory, ComponentMeta } from '@storybook/react';
3
-
4
- export default {
5
- title: 'JS Packages/Components/Jetpack Logo',
6
- component: JetpackLogo,
7
- argTypes: {
8
- logoColor: { control: 'color' },
9
- },
10
- } as ComponentMeta< typeof JetpackLogo >;
11
-
12
- const Template: ComponentStory< typeof JetpackLogo > = args => <JetpackLogo { ...args } />;
13
-
14
- const DefaultArgs = {
15
- width: 150,
16
- className: 'sample-classname',
17
- };
18
-
19
- export const _default = Template.bind( {} );
20
- _default.args = DefaultArgs;
@@ -1,16 +0,0 @@
1
- import { render, screen } from '@testing-library/react';
2
- import JetpackLogo from '../index';
3
-
4
- describe( 'JetpackLogo', () => {
5
- const testProps = {
6
- className: 'sample-classname',
7
- };
8
-
9
- describe( 'Render the JetpackLogo component', () => {
10
- it( 'validate the class name', () => {
11
- render( <JetpackLogo { ...testProps } /> );
12
-
13
- expect( screen.getByLabelText( 'Jetpack Logo' ) ).toHaveClass( testProps.className );
14
- } );
15
- } );
16
- } );
@@ -1,21 +0,0 @@
1
- import JetpackSearchLogo from '../index';
2
- import type { ComponentStory, ComponentMeta } from '@storybook/react';
3
-
4
- export default {
5
- title: 'JS Packages/Components/Jetpack Search Logo',
6
- component: JetpackSearchLogo,
7
- argTypes: {
8
- logoColor: { control: 'color' },
9
- },
10
- } as ComponentMeta< typeof JetpackSearchLogo >;
11
-
12
- const Template: ComponentStory< typeof JetpackSearchLogo > = args => (
13
- <JetpackSearchLogo { ...args } />
14
- );
15
-
16
- const DefaultArgs = {
17
- className: 'sample-classname',
18
- };
19
-
20
- export const _default = Template.bind( {} );
21
- _default.args = DefaultArgs;
@@ -1,16 +0,0 @@
1
- import { render, screen } from '@testing-library/react';
2
- import JetpackSearchLogo from '../index';
3
-
4
- describe( 'JetpackSearchLogo', () => {
5
- const testProps = {
6
- className: 'sample-classname',
7
- };
8
-
9
- describe( 'Render the JetpackSearchLogo component', () => {
10
- it( 'validate the class name', () => {
11
- render( <JetpackSearchLogo { ...testProps } /> );
12
-
13
- expect( screen.getByLabelText( 'Jetpack Search Logo' ) ).toHaveClass( testProps.className );
14
- } );
15
- } );
16
- } );
@@ -1,20 +0,0 @@
1
- import JetpackVaultPressBackupLogo from '../index';
2
- import type { ComponentStory, ComponentMeta } from '@storybook/react';
3
-
4
- export default {
5
- title: 'JS Packages/Components/Jetpack VaultPress Backup Logo',
6
- component: JetpackVaultPressBackupLogo,
7
- argTypes: {},
8
- } as ComponentMeta< typeof JetpackVaultPressBackupLogo >;
9
-
10
- const Template: ComponentStory< typeof JetpackVaultPressBackupLogo > = args => (
11
- <JetpackVaultPressBackupLogo { ...args } />
12
- );
13
-
14
- const DefaultArgs = {
15
- width: 150,
16
- className: 'sample-classname',
17
- };
18
-
19
- export const _default = Template.bind( {} );
20
- _default.args = DefaultArgs;
@@ -1,18 +0,0 @@
1
- import { render, screen } from '@testing-library/react';
2
- import JetpackVaultPressBackupLogo from '../index';
3
-
4
- describe( 'JetpackVaultPressBackupLogo', () => {
5
- const testProps = {
6
- className: 'sample-classname',
7
- };
8
-
9
- describe( 'Render the JetpackVaultPressBackupLogo component', () => {
10
- it( 'validate the class name', () => {
11
- render( <JetpackVaultPressBackupLogo { ...testProps } /> );
12
-
13
- expect( screen.getByLabelText( 'VaultPress Backup Logo' ) ).toHaveClass(
14
- testProps.className
15
- );
16
- } );
17
- } );
18
- } );
@@ -1,20 +0,0 @@
1
- import JetpackVideoPressLogo from '../index';
2
- import type { ComponentStory, ComponentMeta } from '@storybook/react';
3
-
4
- export default {
5
- title: 'JS Packages/Components/Jetpack VideoPress Logo',
6
- component: JetpackVideoPressLogo,
7
- argTypes: {},
8
- } as ComponentMeta< typeof JetpackVideoPressLogo >;
9
-
10
- const Template: ComponentStory< typeof JetpackVideoPressLogo > = args => (
11
- <JetpackVideoPressLogo { ...args } />
12
- );
13
-
14
- const DefaultArgs = {
15
- width: 150,
16
- className: 'sample-classname',
17
- };
18
-
19
- export const _default = Template.bind( {} );
20
- _default.args = DefaultArgs;
@@ -1,16 +0,0 @@
1
- import { render, screen } from '@testing-library/react';
2
- import JetpackVideoPressLogo from '../index';
3
-
4
- describe( 'JetpackVideoPressLogo', () => {
5
- const testProps = {
6
- className: 'sample-classname',
7
- };
8
-
9
- describe( 'Render the JetpackVideoPressLogo component', () => {
10
- it( 'validate the class name', () => {
11
- render( <JetpackVideoPressLogo { ...testProps } /> );
12
-
13
- expect( screen.getByLabelText( 'VideoPress Logo' ) ).toHaveClass( testProps.className );
14
- } );
15
- } );
16
- } );
@@ -1,145 +0,0 @@
1
- import Text from '../../text';
2
- import Col from '../col';
3
- import Container from '../container';
4
- import useBreakpointMatch from '../use-breakpoint-match';
5
- import styles from './styles.module.scss';
6
-
7
- const Layout = ( { items, fluid, horizontalGap, horizontalSpacing } ) => {
8
- return (
9
- <Container
10
- className={ styles.container }
11
- horizontalSpacing={ horizontalSpacing }
12
- fluid={ fluid }
13
- horizontalGap={ horizontalGap }
14
- >
15
- { items.map( ( { sm, lg, md }, idx ) => {
16
- const smText = Number.isInteger( sm?.start ) ? JSON.stringify( sm ) : sm;
17
- const mdText = Number.isInteger( md?.start ) ? JSON.stringify( md ) : md;
18
- const lgText = Number.isInteger( lg?.start ) ? JSON.stringify( lg ) : lg;
19
-
20
- return (
21
- <Col
22
- sm={ sm }
23
- md={ md }
24
- lg={ lg }
25
- className={ styles.col }
26
- key={ `${ smText }${ mdText }${ lgText }${ idx }` }
27
- >
28
- { sm ? `sm=${ smText } ` : '' }
29
- { md ? `md=${ mdText } ` : '' }
30
- { lg ? `lg=${ lgText } ` : '' }
31
- </Col>
32
- );
33
- } ) }
34
- <Col>
35
- <Container fluid horizontalSpacing={ 0 } horizontalGap={ 1 }>
36
- <Col className={ styles.col }>Composition Example</Col>
37
- <Col className={ styles.col }>Composition Example</Col>
38
- </Container>
39
- </Col>
40
- </Container>
41
- );
42
- };
43
-
44
- export default {
45
- title: 'JS Packages/Components/Layout',
46
- component: Layout,
47
- };
48
-
49
- const Template = args => <Layout { ...args } />;
50
- export const Default = Template.bind( {} );
51
- Default.args = {
52
- fluid: false,
53
- horizontalSpacing: 10,
54
- horizontalGap: 5,
55
- items: [
56
- {
57
- sm: 2,
58
- md: 5,
59
- lg: 4,
60
- },
61
- {
62
- sm: 2,
63
- md: 3,
64
- lg: { start: 6, end: 12 },
65
- },
66
- {
67
- sm: 2,
68
- md: 3,
69
- lg: 6,
70
- },
71
- {
72
- sm: 2,
73
- md: 5,
74
- lg: { start: 9, end: 12 },
75
- },
76
- {
77
- sm: 2,
78
- md: 5,
79
- lg: 4,
80
- },
81
- {
82
- sm: 2,
83
- md: 3,
84
- lg: 8,
85
- },
86
- ],
87
- };
88
-
89
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
90
- export const BreakpointMatch = args => {
91
- const [ isSm, isGtSm, isMd, isLtOrMd, isLtMd, isGtOrMd, isGtMd, isLessThanLg, isLg ] =
92
- useBreakpointMatch(
93
- [ 'sm', 'sm', 'md', 'md', 'md', 'md', 'md', 'lg', 'lg' ],
94
- [ null, '>', null, '<=', '<', '>=', '>', '<', null ]
95
- );
96
-
97
- return (
98
- <Container>
99
- { /* SMALL */ }
100
- <Text variant="headline-small">Small</Text>
101
- <Col>
102
- <Text variant="title-small">Is Small</Text>
103
- <Text className={ isSm ? styles.yes : styles.no }>{ isSm ? 'Yes' : 'False' }</Text>
104
- </Col>
105
- <Col>
106
- <Text variant="title-small">Is greater than Small</Text>
107
- <Text className={ isGtSm ? styles.yes : styles.no }>{ isGtSm ? 'Yes' : 'False' }</Text>
108
- </Col>
109
- { /* MEDIUM */ }
110
- <Text variant="headline-small">Medium</Text>
111
- <Col>
112
- <Text variant="title-small">Is Medium</Text>
113
- <Text className={ isMd ? styles.yes : styles.no }>{ isMd ? 'Yes' : 'False' }</Text>
114
- </Col>
115
- <Col>
116
- <Text variant="title-small">Is less then Medium</Text>
117
- <Text className={ isLtMd ? styles.yes : styles.no }>{ isLtMd ? 'Yes' : 'False' }</Text>
118
- </Col>
119
- <Col>
120
- <Text variant="title-small">Is less then OR Medium</Text>
121
- <Text className={ isLtOrMd ? styles.yes : styles.no }>{ isLtOrMd ? 'Yes' : 'False' }</Text>
122
- </Col>
123
- <Col>
124
- <Text variant="title-small">Is greater then Medium</Text>
125
- <Text className={ isGtMd ? styles.yes : styles.no }>{ isGtMd ? 'Yes' : 'False' }</Text>
126
- </Col>
127
- <Col>
128
- <Text variant="title-small">Is greater then OR Medium</Text>
129
- <Text className={ isGtOrMd ? styles.yes : styles.no }>{ isGtOrMd ? 'Yes' : 'False' }</Text>
130
- </Col>
131
- { /* LARGE */ }
132
- <Text variant="headline-small">Large</Text>
133
- <Col>
134
- <Text variant="title-small">Is Large</Text>
135
- <Text className={ isLg ? styles.yes : styles.no }>{ isLg ? 'Yes' : 'False' }</Text>
136
- </Col>
137
- <Col>
138
- <Text variant="title-small">Is less than Large</Text>
139
- <Text className={ isLessThanLg ? styles.yes : styles.no }>
140
- { isLessThanLg ? 'Yes' : 'False' }
141
- </Text>
142
- </Col>
143
- </Container>
144
- );
145
- };