|
1 | 1 | import { ThemeProvider, jetpackTheme, wooTheme } from '../../../providers/theme'; |
2 | 2 | import { formatMetricValue } from '../../shared/format-metric-value'; |
3 | 3 | import { LeaderboardChart } from '../leaderboard-chart'; |
4 | | -import { sampleData, smallDataset, largeValues, negativeGrowth } from './sample-data'; |
| 4 | +import { |
| 5 | + sampleData, |
| 6 | + smallDataset, |
| 7 | + largeValues, |
| 8 | + negativeGrowth, |
| 9 | + salesByProduct, |
| 10 | +} from './sample-data'; |
5 | 11 | import type { Meta, StoryObj } from '@storybook/react'; |
6 | 12 |
|
7 | 13 | const meta: Meta< typeof LeaderboardChart > = { |
@@ -378,14 +384,9 @@ export const CustomLabel: Story = { |
378 | 384 | data: smallDataset.map( entry => ( { |
379 | 385 | ...entry, |
380 | 386 | label: ( |
381 | | - <div style={ { display: 'flex', alignItems: 'center', gap: '8px' } }> |
382 | | - <img |
383 | | - src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23e25555' viewBox='0 0 24 24'%3E%3Cpath d='M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41 0.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z'/%3E%3C/svg%3E" |
384 | | - alt="icon" |
385 | | - style={ { width: '32px', height: '32px', marginLeft: '8px', verticalAlign: 'middle' } } |
386 | | - /> |
387 | | - <span style={ { fontSize: '24px' } }>{ entry.label }</span> |
388 | | - </div> |
| 387 | + <span style={ { fontSize: '24px', padding: '8px 16px', color: '#EEEEEE' } }> |
| 388 | + { entry.label } |
| 389 | + </span> |
389 | 390 | ), |
390 | 391 | } ) ), |
391 | 392 | withComparison: false, |
@@ -455,3 +456,48 @@ export const WooCommerceTheme: Story = { |
455 | 456 | ), |
456 | 457 | ], |
457 | 458 | }; |
| 459 | + |
| 460 | +export const WooAnalyticsSalesByProduct: Story = { |
| 461 | + args: { |
| 462 | + data: salesByProduct.map( entry => ( { |
| 463 | + ...entry, |
| 464 | + label: ( |
| 465 | + <div |
| 466 | + style={ { |
| 467 | + display: 'flex', |
| 468 | + alignItems: 'center', |
| 469 | + gap: '8px', |
| 470 | + padding: '6px', |
| 471 | + } } |
| 472 | + > |
| 473 | + <img |
| 474 | + src={ `data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='50' height='50'><rect width='50' height='50' fill='${ entry.color }'/></svg>` } |
| 475 | + alt="icon" |
| 476 | + style={ { |
| 477 | + width: '28px', |
| 478 | + height: '28px', |
| 479 | + verticalAlign: 'middle', |
| 480 | + borderRadius: '4px', |
| 481 | + } } |
| 482 | + /> |
| 483 | + <span style={ { fontSize: '13px' } }>{ entry.label }</span> |
| 484 | + </div> |
| 485 | + ), |
| 486 | + } ) ), |
| 487 | + primaryColor: '#F0F2FD', |
| 488 | + withComparison: true, |
| 489 | + withOverlayLabel: true, |
| 490 | + loading: false, |
| 491 | + style: { |
| 492 | + '--bar-border-radius': '4px', |
| 493 | + fontFamily: `"SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif`, |
| 494 | + }, |
| 495 | + }, |
| 496 | + decorators: [ |
| 497 | + Story => ( |
| 498 | + <ThemeProvider theme={ wooTheme }> |
| 499 | + <Story /> |
| 500 | + </ThemeProvider> |
| 501 | + ), |
| 502 | + ], |
| 503 | +}; |
0 commit comments