@ssa-ui-kit/widgets 1.0.12 → 1.1.55-canary-79b6b0d-20250224
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.
- package/dist/components/AccountBalance/AccountBalance.d.ts +1 -1
- package/dist/components/AccountBalance/BalancePieChart.d.ts +1 -1
- package/dist/components/AccountBalance/BalancePieChartTitle.d.ts +1 -1
- package/dist/components/AccountKeys/AccountKeys.d.ts +1 -1
- package/dist/components/AccountKeys/stories/StoryComponent.d.ts +1 -1
- package/dist/components/Activity/Activity.d.ts +1 -1
- package/dist/components/Activity/ActivityItem.d.ts +1 -1
- package/dist/components/Bmi/Bmi.d.ts +1 -1
- package/dist/components/Bmi/BmiLabels.d.ts +1 -1
- package/dist/components/BotsTable/BotsTable.d.ts +1 -1
- package/dist/components/BotsTable/stories/BotsTable/StoryComponent.d.ts +1 -1
- package/dist/components/BotsTable/stories/BotsTable/components/Actions/ActionIcon.d.ts +1 -1
- package/dist/components/BotsTable/stories/BotsTable/components/Actions/ActionItem.d.ts +1 -1
- package/dist/components/BotsTable/stories/BotsTable/components/Actions/ActionMore.d.ts +1 -1
- package/dist/components/BotsTable/stories/BotsTable/components/Actions/ActionRun.d.ts +1 -1
- package/dist/components/BotsTable/stories/BotsTable/components/Actions/Actions.d.ts +1 -1
- package/dist/components/BotsTable/stories/BotsTable/components/Actions/ActionsWrapper.d.ts +1 -1
- package/dist/components/BotsTable/stories/BotsTable/components/Actions/consts.d.ts +3 -3
- package/dist/components/BotsTable/stories/BotsTable/components/Exchange/Exchange.d.ts +1 -1
- package/dist/components/BotsTable/stories/BotsTable/components/Exchange/consts.d.ts +3 -3
- package/dist/components/BotsTable/stories/BotsTable/components/PNL.d.ts +1 -1
- package/dist/components/BotsTable/stories/BotsTable/components/ROI.d.ts +1 -1
- package/dist/components/BotsTable/stories/BotsTable/components/TableTag.d.ts +1 -1
- package/dist/components/BotsTable/stories/BotsTable/components/Trade/Trade.d.ts +1 -1
- package/dist/components/BotsTable/stories/NoControlOrders/StoryComponent.d.ts +1 -1
- package/dist/components/BotsTable/stories/NoControlOrders/components/ActionMore.d.ts +1 -1
- package/dist/components/BotsTable/stories/NoControlOrders/components/Reason.d.ts +1 -1
- package/dist/components/BotsTable/stories/NoControlOrders/components/TableList.d.ts +1 -1
- package/dist/components/BotsTable/stories/NoControlOrders/components/TableRow.d.ts +1 -1
- package/dist/components/Calories/Calories.d.ts +1 -1
- package/dist/components/Calories/innerContent.d.ts +1 -1
- package/dist/components/ExchangeAccount/ExchangeAccount.d.ts +1 -1
- package/dist/components/HeartRate/BPM.d.ts +1 -1
- package/dist/components/HeartRate/HeartRate.d.ts +1 -1
- package/dist/components/HeartRate/HeartRateLineChart.d.ts +1 -1
- package/dist/components/ListGoals/ListGoals.d.ts +1 -1
- package/dist/components/ListGoals/ListGoalsCard.d.ts +1 -1
- package/dist/components/MealNutrients/MealNutrients.d.ts +1 -1
- package/dist/components/MealNutrients/MealNutrientsLineChart.d.ts +1 -1
- package/dist/components/MealNutrients/MealNutrientsTooltip.d.ts +1 -1
- package/dist/components/MealPlanner/MealPlanner.d.ts +1 -1
- package/dist/components/MealPlanner/MealPlannerCard.d.ts +1 -1
- package/dist/components/StepsCounter/StepsCounter.d.ts +1 -1
- package/dist/components/TradingInfoCard/TradingInfoCard.d.ts +1 -1
- package/dist/components/TradingInfoCard/TradingInfoCardContent.d.ts +1 -1
- package/dist/components/TradingInfoCard/TradingInfoCardTooltip.d.ts +1 -1
- package/dist/components/TradingInfoCard/TradingInfoCardWrapper.d.ts +1 -1
- package/dist/components/TradingScoreboard/TradingScoreboard.d.ts +1 -1
- package/dist/components/TradingScoreboard/helpers.d.ts +4 -4
- package/dist/components/UpcomingWorkouts/UpcomingWorkoutCard.d.ts +1 -1
- package/dist/components/UpcomingWorkouts/UpcomingWorkouts.d.ts +1 -1
- package/dist/components/UserCard/UserCard.d.ts +1 -1
- package/dist/components/UserCard/UserCardBMI.d.ts +1 -1
- package/dist/components/UserCard/UserCardCredentials.d.ts +1 -1
- package/dist/components/UserCard/UserCardItem.d.ts +1 -1
- package/dist/components/WaterConsume/WaterConsume.d.ts +1 -1
- package/dist/index.js +2439 -1
- package/dist/index.js.map +1 -1
- package/package.json +24 -27
- package/.babelrc.js +0 -4
- package/.env +0 -7
- package/.storybook/main.ts +0 -47
- package/.storybook/preview.tsx +0 -22
- package/.storybook/style.css +0 -40
- package/custom-shots/widgets-bots-table--no-control-orders--menu-opened_[w1920px].png +0 -0
- package/custom-shots/widgets-bots-table--no-control-orders--run-reason-modal_[w1920px].png +0 -0
- package/custom-shots/widgets-heart-rate--hint-opened__[w1440px].png +0 -0
- package/custom-shots/widgets-heart-rate--hint-opened__[w1920px].png +0 -0
- package/custom-shots/widgets-heart-rate--hint-opened__[w390px].png +0 -0
- package/custom-shots/widgets-heart-rate--hint-opened__[w900px].png +0 -0
- package/custom-shots/widgets-meal-nutrients--hint-opened__[w1440px].png +0 -0
- package/custom-shots/widgets-meal-nutrients--hint-opened__[w1920px].png +0 -0
- package/custom-shots/widgets-meal-nutrients--hint-opened__[w390px].png +0 -0
- package/custom-shots/widgets-meal-nutrients--hint-opened__[w900px].png +0 -0
- package/custom-shots/widgets-meal-nutrients--hint-opened__dropdown__[w1440px].png +0 -0
- package/custom-shots/widgets-meal-nutrients--hint-opened__dropdown__[w1920px].png +0 -0
- package/custom-shots/widgets-meal-nutrients--hint-opened__dropdown__[w390px].png +0 -0
- package/custom-shots/widgets-meal-nutrients--hint-opened__dropdown__[w900px].png +0 -0
- package/custom-shots/widgets-trading-info-card--hover__[w1920px].png +0 -0
- package/customTest.tsx +0 -35
- package/jest-setup.ts +0 -20
- package/lostpixel.config.ts +0 -29
- package/playwright.config.ts +0 -7
- package/src/components/AccountBalance/AccountBalance.specBackup.tsx +0 -105
- package/src/components/AccountBalance/AccountBalance.stories.tsx +0 -138
- package/src/components/AccountBalance/AccountBalance.tsx +0 -60
- package/src/components/AccountBalance/BalancePieChart.tsx +0 -127
- package/src/components/AccountBalance/BalancePieChartTitle.tsx +0 -54
- package/src/components/AccountBalance/index.ts +0 -4
- package/src/components/AccountBalance/stories/fixtures.ts +0 -26
- package/src/components/AccountBalance/types.ts +0 -41
- package/src/components/AccountKeys/AccountKeys.specBackup.tsx +0 -43
- package/src/components/AccountKeys/AccountKeys.stories.tsx +0 -14
- package/src/components/AccountKeys/AccountKeys.tsx +0 -73
- package/src/components/AccountKeys/helpers.ts +0 -7
- package/src/components/AccountKeys/index.ts +0 -2
- package/src/components/AccountKeys/stories/StoryComponent.tsx +0 -33
- package/src/components/AccountKeys/styles.ts +0 -87
- package/src/components/AccountKeys/types.ts +0 -8
- package/src/components/Activity/Activity.specBackup.tsx +0 -79
- package/src/components/Activity/Activity.stories.tsx +0 -15
- package/src/components/Activity/Activity.tsx +0 -83
- package/src/components/Activity/ActivityItem.tsx +0 -38
- package/src/components/Activity/index.tsx +0 -2
- package/src/components/Activity/mockActivityRequest.ts +0 -106
- package/src/components/Activity/styles.ts +0 -12
- package/src/components/Activity/types.ts +0 -10
- package/src/components/Bmi/Bmi.spec.Backup.tsx +0 -68
- package/src/components/Bmi/Bmi.stories.tsx +0 -10
- package/src/components/Bmi/Bmi.tsx +0 -96
- package/src/components/Bmi/BmiHeatbar.tsx +0 -18
- package/src/components/Bmi/BmiInfo.tsx +0 -11
- package/src/components/Bmi/BmiLabel.tsx +0 -9
- package/src/components/Bmi/BmiLabels.tsx +0 -33
- package/src/components/Bmi/BmiPointer.tsx +0 -15
- package/src/components/Bmi/index.tsx +0 -2
- package/src/components/Bmi/styles.ts +0 -18
- package/src/components/Bmi/types.ts +0 -4
- package/src/components/BotsTable/BotsTable.e2e.ts +0 -77
- package/src/components/BotsTable/BotsTable.specBackup.tsx +0 -125
- package/src/components/BotsTable/BotsTable.tsx +0 -32
- package/src/components/BotsTable/BotsTableCell.tsx +0 -13
- package/src/components/BotsTable/BotsTableHead.tsx +0 -13
- package/src/components/BotsTable/BotsTableRow.tsx +0 -17
- package/src/components/BotsTable/BotsTableWrapper.tsx +0 -23
- package/src/components/BotsTable/index.ts +0 -5
- package/src/components/BotsTable/stories/BotsTable/StoryComponent.tsx +0 -59
- package/src/components/BotsTable/stories/BotsTable/components/Actions/ActionIcon.tsx +0 -11
- package/src/components/BotsTable/stories/BotsTable/components/Actions/ActionItem.tsx +0 -40
- package/src/components/BotsTable/stories/BotsTable/components/Actions/ActionMore.tsx +0 -89
- package/src/components/BotsTable/stories/BotsTable/components/Actions/ActionRun.tsx +0 -133
- package/src/components/BotsTable/stories/BotsTable/components/Actions/Actions.tsx +0 -13
- package/src/components/BotsTable/stories/BotsTable/components/Actions/ActionsWrapper.tsx +0 -21
- package/src/components/BotsTable/stories/BotsTable/components/Actions/consts.tsx +0 -118
- package/src/components/BotsTable/stories/BotsTable/components/Actions/index.ts +0 -6
- package/src/components/BotsTable/stories/BotsTable/components/Exchange/Exchange.tsx +0 -26
- package/src/components/BotsTable/stories/BotsTable/components/Exchange/consts.tsx +0 -157
- package/src/components/BotsTable/stories/BotsTable/components/Exchange/index.ts +0 -1
- package/src/components/BotsTable/stories/BotsTable/components/Exchange/types.ts +0 -6
- package/src/components/BotsTable/stories/BotsTable/components/PNL.tsx +0 -27
- package/src/components/BotsTable/stories/BotsTable/components/ROI.tsx +0 -25
- package/src/components/BotsTable/stories/BotsTable/components/TableTag.tsx +0 -22
- package/src/components/BotsTable/stories/BotsTable/components/Trade/Trade.tsx +0 -8
- package/src/components/BotsTable/stories/BotsTable/components/Trade/consts.ts +0 -14
- package/src/components/BotsTable/stories/BotsTable/components/Trade/index.ts +0 -1
- package/src/components/BotsTable/stories/BotsTable/components/Trade/types.ts +0 -5
- package/src/components/BotsTable/stories/BotsTable/components/index.ts +0 -6
- package/src/components/BotsTable/stories/BotsTable/index.ts +0 -1
- package/src/components/BotsTable/stories/BotsTable/mockData.ts +0 -84
- package/src/components/BotsTable/stories/BotsTable.stories.tsx +0 -39
- package/src/components/BotsTable/stories/NoControlOrders/StoryComponent.tsx +0 -35
- package/src/components/BotsTable/stories/NoControlOrders/components/ActionMore.tsx +0 -95
- package/src/components/BotsTable/stories/NoControlOrders/components/Reason.tsx +0 -11
- package/src/components/BotsTable/stories/NoControlOrders/components/TableList.tsx +0 -45
- package/src/components/BotsTable/stories/NoControlOrders/components/TableRow.tsx +0 -31
- package/src/components/BotsTable/stories/NoControlOrders/components/index.ts +0 -4
- package/src/components/BotsTable/stories/NoControlOrders/mockData.ts +0 -23
- package/src/components/BotsTable/stories/NoControlOrders/types.ts +0 -16
- package/src/components/BotsTable/types.ts +0 -31
- package/src/components/Calories/Calories.specBackup.tsx +0 -11
- package/src/components/Calories/Calories.stories.tsx +0 -26
- package/src/components/Calories/Calories.tsx +0 -54
- package/src/components/Calories/index.tsx +0 -2
- package/src/components/Calories/innerContent.tsx +0 -30
- package/src/components/Calories/types.ts +0 -4
- package/src/components/ExchangeAccount/ExchangeAccount.specBackup.tsx +0 -104
- package/src/components/ExchangeAccount/ExchangeAccount.stories.tsx +0 -108
- package/src/components/ExchangeAccount/ExchangeAccount.tsx +0 -90
- package/src/components/ExchangeAccount/helpers.tsx +0 -153
- package/src/components/ExchangeAccount/index.ts +0 -2
- package/src/components/ExchangeAccount/styles.ts +0 -115
- package/src/components/ExchangeAccount/types.ts +0 -14
- package/src/components/HeartRate/BPM.tsx +0 -43
- package/src/components/HeartRate/HeartRate.e2e.ts +0 -78
- package/src/components/HeartRate/HeartRate.specBackup.tsx +0 -91
- package/src/components/HeartRate/HeartRate.stories.tsx +0 -36
- package/src/components/HeartRate/HeartRate.tsx +0 -105
- package/src/components/HeartRate/HeartRateLineChart.tsx +0 -53
- package/src/components/HeartRate/index.ts +0 -2
- package/src/components/HeartRate/mockHeartRateRequest.ts +0 -15
- package/src/components/HeartRate/types.ts +0 -15
- package/src/components/HeartRate/utils.tsx +0 -8
- package/src/components/ListGoals/ListGoals.specBackup.tsx +0 -82
- package/src/components/ListGoals/ListGoals.stories.tsx +0 -58
- package/src/components/ListGoals/ListGoals.tsx +0 -29
- package/src/components/ListGoals/ListGoalsCard.tsx +0 -61
- package/src/components/ListGoals/index.ts +0 -2
- package/src/components/ListGoals/styles.tsx +0 -11
- package/src/components/ListGoals/types.ts +0 -25
- package/src/components/MealNutrients/MealNutrients.e2e.ts +0 -68
- package/src/components/MealNutrients/MealNutrients.specBackup.tsx +0 -134
- package/src/components/MealNutrients/MealNutrients.stories.tsx +0 -37
- package/src/components/MealNutrients/MealNutrients.tsx +0 -84
- package/src/components/MealNutrients/MealNutrientsLineChart.tsx +0 -89
- package/src/components/MealNutrients/MealNutrientsTooltip.tsx +0 -30
- package/src/components/MealNutrients/chartDefaultConfig.tsx +0 -87
- package/src/components/MealNutrients/index.tsx +0 -2
- package/src/components/MealNutrients/mockMealNutrientsRequest.ts +0 -1246
- package/src/components/MealNutrients/types.ts +0 -37
- package/src/components/MealNutrients/useChartConfig.ts +0 -69
- package/src/components/MealPlanner/MealPlanner.specBackup.tsx +0 -77
- package/src/components/MealPlanner/MealPlanner.stories.tsx +0 -15
- package/src/components/MealPlanner/MealPlanner.tsx +0 -100
- package/src/components/MealPlanner/MealPlannerBadge.tsx +0 -15
- package/src/components/MealPlanner/MealPlannerBars.tsx +0 -19
- package/src/components/MealPlanner/MealPlannerCard.tsx +0 -73
- package/src/components/MealPlanner/MealPlannerLegends.tsx +0 -22
- package/src/components/MealPlanner/index.ts +0 -2
- package/src/components/MealPlanner/mockMealPlannerRequest.ts +0 -70
- package/src/components/MealPlanner/types.ts +0 -21
- package/src/components/StepsCounter/StepsCounter.specBackup.tsx +0 -14
- package/src/components/StepsCounter/StepsCounter.stories.tsx +0 -16
- package/src/components/StepsCounter/StepsCounter.tsx +0 -74
- package/src/components/StepsCounter/index.ts +0 -2
- package/src/components/StepsCounter/types.ts +0 -4
- package/src/components/TradingInfoCard/TradingInfoCard.e2e.ts +0 -18
- package/src/components/TradingInfoCard/TradingInfoCard.specBackup.tsx +0 -116
- package/src/components/TradingInfoCard/TradingInfoCard.stories.tsx +0 -118
- package/src/components/TradingInfoCard/TradingInfoCard.tsx +0 -49
- package/src/components/TradingInfoCard/TradingInfoCardContent.tsx +0 -32
- package/src/components/TradingInfoCard/TradingInfoCardTooltip.tsx +0 -47
- package/src/components/TradingInfoCard/TradingInfoCardWrapper.tsx +0 -72
- package/src/components/TradingInfoCard/index.ts +0 -3
- package/src/components/TradingInfoCard/types.ts +0 -27
- package/src/components/TradingScoreboard/TradingScoreboard.specBackup.tsx +0 -119
- package/src/components/TradingScoreboard/TradingScoreboard.stories.tsx +0 -119
- package/src/components/TradingScoreboard/TradingScoreboard.tsx +0 -41
- package/src/components/TradingScoreboard/TradingScoreboardBase.tsx +0 -17
- package/src/components/TradingScoreboard/helpers.tsx +0 -134
- package/src/components/TradingScoreboard/index.ts +0 -2
- package/src/components/TradingScoreboard/types.ts +0 -18
- package/src/components/UpcomingWorkouts/UpcomingWorkoutCard.tsx +0 -64
- package/src/components/UpcomingWorkouts/UpcomingWorkouts.specBackup.tsx +0 -56
- package/src/components/UpcomingWorkouts/UpcomingWorkouts.stories.tsx +0 -32
- package/src/components/UpcomingWorkouts/UpcomingWorkouts.tsx +0 -27
- package/src/components/UpcomingWorkouts/index.ts +0 -2
- package/src/components/UpcomingWorkouts/style.ts +0 -12
- package/src/components/UpcomingWorkouts/types.ts +0 -23
- package/src/components/UserCard/UserCard.tsx +0 -46
- package/src/components/UserCard/UserCardBMI.tsx +0 -37
- package/src/components/UserCard/UserCardCredentials.tsx +0 -56
- package/src/components/UserCard/UserCardItem.tsx +0 -42
- package/src/components/UserCard/index.tsx +0 -2
- package/src/components/UserCard/types.ts +0 -8
- package/src/components/WaterConsume/WaterConsume.specBackup.tsx +0 -62
- package/src/components/WaterConsume/WaterConsume.stories.tsx +0 -36
- package/src/components/WaterConsume/WaterConsume.tsx +0 -188
- package/src/components/WaterConsume/index.ts +0 -2
- package/src/components/WaterConsume/types.ts +0 -11
- package/src/consts.ts +0 -18
- package/src/index.ts +0 -36
- package/src/injectGlobal.ts +0 -41
- package/test-results/.last-run.json +0 -21
- package/tsbuildcache +0 -1
- package/tsconfig.build.json +0 -44
- package/tsconfig.json +0 -17
- package/webpack.config.js +0 -28
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import { MemoryRouter, Route, Routes } from 'react-router-dom';
|
|
2
|
-
import userEvent from '@testing-library/user-event';
|
|
3
|
-
import { screen, waitFor } from '../../../customTest';
|
|
4
|
-
|
|
5
|
-
import { Icon } from '@ssa-ui-kit/core';
|
|
6
|
-
import TradingInfoCard from './TradingInfoCard';
|
|
7
|
-
|
|
8
|
-
describe('TradingInfoCard', () => {
|
|
9
|
-
it('Renders with value and title', () => {
|
|
10
|
-
render(<TradingInfoCard value={'400'} unit={'%'} title={'Title'} />);
|
|
11
|
-
|
|
12
|
-
screen.getByText('400');
|
|
13
|
-
screen.getByText('Title');
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
it('Renders with value, title, and unit', () => {
|
|
17
|
-
render(<TradingInfoCard value={'400'} unit={'%'} title={'Title'} />);
|
|
18
|
-
|
|
19
|
-
screen.getByText('400');
|
|
20
|
-
screen.getByText('%');
|
|
21
|
-
screen.getByText('Title');
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
it('Renders with value, title, unit, and icon', async () => {
|
|
25
|
-
render(
|
|
26
|
-
<TradingInfoCard
|
|
27
|
-
value={'400'}
|
|
28
|
-
unit={'%'}
|
|
29
|
-
title={'Title'}
|
|
30
|
-
icon={<Icon name="arrow-up" color="#2CA24D" size={16} />}
|
|
31
|
-
/>,
|
|
32
|
-
);
|
|
33
|
-
|
|
34
|
-
screen.getByText('400');
|
|
35
|
-
screen.getByText('%');
|
|
36
|
-
screen.getByText('Title');
|
|
37
|
-
|
|
38
|
-
await screen.findByTitle(/Arrow Up/i);
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
it('Renders with an integer value (no tooltip)', async () => {
|
|
42
|
-
const { queryByTestId } = render(
|
|
43
|
-
<TradingInfoCard value={400} title={'Title'} />,
|
|
44
|
-
);
|
|
45
|
-
|
|
46
|
-
screen.getByText('400');
|
|
47
|
-
await waitFor(() =>
|
|
48
|
-
expect(queryByTestId('floating-arrow')).not.toBeInTheDocument(),
|
|
49
|
-
);
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
it('Renders with a non-numeric value (no tooltip)', async () => {
|
|
53
|
-
const { queryByTestId } = render(
|
|
54
|
-
<TradingInfoCard value={'Test'} title={'Title'} />,
|
|
55
|
-
);
|
|
56
|
-
|
|
57
|
-
screen.getByText('Test');
|
|
58
|
-
await waitFor(() =>
|
|
59
|
-
expect(queryByTestId('floating-arrow')).not.toBeInTheDocument(),
|
|
60
|
-
);
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
it('Renders with a numeric value (tooltip) ', async () => {
|
|
64
|
-
const user = userEvent.setup();
|
|
65
|
-
const { getByTestId, queryByTestId, findByTestId } = render(
|
|
66
|
-
<TradingInfoCard value={400.5} title={'Title'} />,
|
|
67
|
-
);
|
|
68
|
-
|
|
69
|
-
const tooltipEl = getByTestId('tooltip-trigger');
|
|
70
|
-
|
|
71
|
-
await user.hover(tooltipEl);
|
|
72
|
-
await findByTestId('floating-arrow');
|
|
73
|
-
|
|
74
|
-
await user.unhover(tooltipEl);
|
|
75
|
-
await waitFor(() =>
|
|
76
|
-
expect(queryByTestId('floating-arrow')).not.toBeInTheDocument(),
|
|
77
|
-
);
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
it('Calls onClick handler when clicked', async () => {
|
|
81
|
-
const user = userEvent.setup();
|
|
82
|
-
const mockOnClick = jest.fn();
|
|
83
|
-
|
|
84
|
-
const { getByRole } = render(
|
|
85
|
-
<TradingInfoCard
|
|
86
|
-
value={'400.500'}
|
|
87
|
-
title={'Title'}
|
|
88
|
-
onClick={mockOnClick}
|
|
89
|
-
/>,
|
|
90
|
-
);
|
|
91
|
-
|
|
92
|
-
const button = getByRole('button');
|
|
93
|
-
|
|
94
|
-
await user.click(button);
|
|
95
|
-
|
|
96
|
-
expect(mockOnClick).toBeCalledTimes(1);
|
|
97
|
-
expect(button).toHaveAttribute('tabindex', '0');
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
it('Renders with link prop', () => {
|
|
101
|
-
const { getByRole } = render(
|
|
102
|
-
<MemoryRouter>
|
|
103
|
-
<Routes>
|
|
104
|
-
<Route
|
|
105
|
-
path="/*"
|
|
106
|
-
element={
|
|
107
|
-
<TradingInfoCard value={'5000'} title={'Test'} link={'/'} />
|
|
108
|
-
}
|
|
109
|
-
/>
|
|
110
|
-
</Routes>
|
|
111
|
-
</MemoryRouter>,
|
|
112
|
-
);
|
|
113
|
-
|
|
114
|
-
expect(getByRole('link')).toHaveAttribute('href', '/');
|
|
115
|
-
});
|
|
116
|
-
});
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import { MemoryRouter, Route, Routes } from 'react-router-dom';
|
|
2
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
-
import { Icon } from '@ssa-ui-kit/core';
|
|
4
|
-
import TradingInfoCard from './TradingInfoCard';
|
|
5
|
-
import { TradingInfoCardProps } from './types';
|
|
6
|
-
|
|
7
|
-
export default {
|
|
8
|
-
title: 'Trading/TradingInfoCard',
|
|
9
|
-
component: TradingInfoCard,
|
|
10
|
-
} as Meta<typeof TradingInfoCard>;
|
|
11
|
-
|
|
12
|
-
export const Default: StoryObj<typeof TradingInfoCard> = (
|
|
13
|
-
args: TradingInfoCardProps,
|
|
14
|
-
) => {
|
|
15
|
-
return (
|
|
16
|
-
<TradingInfoCard
|
|
17
|
-
value={args.value}
|
|
18
|
-
unit={args.unit}
|
|
19
|
-
title={args.title}
|
|
20
|
-
icon={args.icon}
|
|
21
|
-
onClick={() => alert('clicked!')}
|
|
22
|
-
/>
|
|
23
|
-
);
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
Default.args = {
|
|
27
|
-
value: 500.55,
|
|
28
|
-
unit: 'USD',
|
|
29
|
-
title: 'Turnover',
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
export const WithLink: StoryObj<typeof TradingInfoCard> = (
|
|
33
|
-
args: TradingInfoCardProps,
|
|
34
|
-
) => {
|
|
35
|
-
return (
|
|
36
|
-
<MemoryRouter>
|
|
37
|
-
<Routes>
|
|
38
|
-
<Route
|
|
39
|
-
path="/*"
|
|
40
|
-
element={
|
|
41
|
-
<TradingInfoCard
|
|
42
|
-
value={args.value}
|
|
43
|
-
unit={args.unit}
|
|
44
|
-
title={args.title}
|
|
45
|
-
icon={args.icon}
|
|
46
|
-
link={'/link'}
|
|
47
|
-
/>
|
|
48
|
-
}
|
|
49
|
-
/>
|
|
50
|
-
</Routes>
|
|
51
|
-
</MemoryRouter>
|
|
52
|
-
);
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
WithLink.args = {
|
|
56
|
-
value: '500',
|
|
57
|
-
unit: 'USD',
|
|
58
|
-
title: 'Turnover',
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
export const WithTooltip: StoryObj<typeof TradingInfoCard> = (
|
|
62
|
-
args: TradingInfoCardProps,
|
|
63
|
-
) => {
|
|
64
|
-
return (
|
|
65
|
-
<TradingInfoCard
|
|
66
|
-
value={args.value}
|
|
67
|
-
unit={args.unit}
|
|
68
|
-
title={args.title}
|
|
69
|
-
icon={args.icon}
|
|
70
|
-
onClick={() => alert('clicked!')}
|
|
71
|
-
/>
|
|
72
|
-
);
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
WithTooltip.args = {
|
|
76
|
-
value: '500.025',
|
|
77
|
-
unit: 'USD',
|
|
78
|
-
title: 'Turnover',
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
export const WithIcon: StoryObj<typeof TradingInfoCard> = (
|
|
82
|
-
args: TradingInfoCardProps,
|
|
83
|
-
) => {
|
|
84
|
-
return (
|
|
85
|
-
<TradingInfoCard
|
|
86
|
-
value={args.value}
|
|
87
|
-
unit={args.unit}
|
|
88
|
-
title={args.title}
|
|
89
|
-
icon={args.icon}
|
|
90
|
-
onClick={() => alert('clicked!')}
|
|
91
|
-
/>
|
|
92
|
-
);
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
WithIcon.args = {
|
|
96
|
-
value: '500.025',
|
|
97
|
-
unit: 'USD',
|
|
98
|
-
title: 'Turnover',
|
|
99
|
-
icon: <Icon name="arrow-up" color="#2CA24D" size={16} />,
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
export const WithoutUnit: StoryObj<typeof TradingInfoCard> = (
|
|
103
|
-
args: TradingInfoCardProps,
|
|
104
|
-
) => {
|
|
105
|
-
return (
|
|
106
|
-
<TradingInfoCard
|
|
107
|
-
value={args.value}
|
|
108
|
-
unit={args.unit}
|
|
109
|
-
title={args.title}
|
|
110
|
-
icon={args.icon}
|
|
111
|
-
/>
|
|
112
|
-
);
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
WithoutUnit.args = {
|
|
116
|
-
value: 'ETH/USDT',
|
|
117
|
-
title: 'Pairs',
|
|
118
|
-
};
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { CardContent, Typography } from '@ssa-ui-kit/core';
|
|
2
|
-
|
|
3
|
-
import TradingInfoCardContent from './TradingInfoCardContent';
|
|
4
|
-
import TradingInfoCardTooltip from './TradingInfoCardTooltip';
|
|
5
|
-
import TradingInfoCardWrapper from './TradingInfoCardWrapper';
|
|
6
|
-
import { TradingInfoCardProps } from './types';
|
|
7
|
-
|
|
8
|
-
const TradingInfoCardView = ({
|
|
9
|
-
value,
|
|
10
|
-
unit,
|
|
11
|
-
title,
|
|
12
|
-
icon,
|
|
13
|
-
link,
|
|
14
|
-
onClick,
|
|
15
|
-
}: TradingInfoCardProps) => {
|
|
16
|
-
const number = Number(value);
|
|
17
|
-
const currentValue = Number.isNaN(number)
|
|
18
|
-
? value
|
|
19
|
-
: number.toFixed(1).includes('.0')
|
|
20
|
-
? Math.floor(number)
|
|
21
|
-
: number.toFixed(1);
|
|
22
|
-
|
|
23
|
-
return (
|
|
24
|
-
<TradingInfoCardWrapper onClick={onClick} link={link}>
|
|
25
|
-
<TradingInfoCardContent value={currentValue} unit={unit} icon={icon} />
|
|
26
|
-
<CardContent>
|
|
27
|
-
<Typography css={{ fontSize: '12px' }}>{title}</Typography>
|
|
28
|
-
</CardContent>
|
|
29
|
-
</TradingInfoCardWrapper>
|
|
30
|
-
);
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
const TradingInfoCard = (props: TradingInfoCardProps) => {
|
|
34
|
-
const { value, unit } = props;
|
|
35
|
-
const number = Number(value);
|
|
36
|
-
const isInteger = Number.isInteger(number);
|
|
37
|
-
|
|
38
|
-
if (isInteger || Number.isNaN(number)) {
|
|
39
|
-
return <TradingInfoCardView {...props} />;
|
|
40
|
-
} else {
|
|
41
|
-
return (
|
|
42
|
-
<TradingInfoCardTooltip trigger={<TradingInfoCardView {...props} />}>
|
|
43
|
-
{value} {unit}
|
|
44
|
-
</TradingInfoCardTooltip>
|
|
45
|
-
);
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
export default TradingInfoCard;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { useTheme } from '@emotion/react';
|
|
2
|
-
import { CardContent, Typography } from '@ssa-ui-kit/core';
|
|
3
|
-
|
|
4
|
-
import { TradingInfoContent } from './types';
|
|
5
|
-
|
|
6
|
-
const TradingInfoCardContent = ({ value, unit, icon }: TradingInfoContent) => {
|
|
7
|
-
const theme = useTheme();
|
|
8
|
-
return (
|
|
9
|
-
<CardContent
|
|
10
|
-
css={{
|
|
11
|
-
justifyContent: 'flex-start',
|
|
12
|
-
alignItems: 'baseline',
|
|
13
|
-
gap: '2px',
|
|
14
|
-
}}>
|
|
15
|
-
<Typography variant="h5" weight="bold" color={theme.colors.greyDarker}>
|
|
16
|
-
{value}
|
|
17
|
-
</Typography>
|
|
18
|
-
{unit ? (
|
|
19
|
-
<Typography data-testid="unit" variant="h6" weight="lighter">
|
|
20
|
-
{unit}
|
|
21
|
-
</Typography>
|
|
22
|
-
) : null}
|
|
23
|
-
{icon ? (
|
|
24
|
-
<div css={{ display: 'flex', alignSelf: 'center', marginLeft: '3px' }}>
|
|
25
|
-
{icon}
|
|
26
|
-
</div>
|
|
27
|
-
) : null}
|
|
28
|
-
</CardContent>
|
|
29
|
-
);
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
export default TradingInfoCardContent;
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { css, useTheme } from '@emotion/react';
|
|
2
|
-
import {
|
|
3
|
-
Tooltip,
|
|
4
|
-
TooltipContent,
|
|
5
|
-
TooltipTrigger,
|
|
6
|
-
Typography,
|
|
7
|
-
} from '@ssa-ui-kit/core';
|
|
8
|
-
|
|
9
|
-
import { TradingInfoCardTooltipProps } from './types';
|
|
10
|
-
|
|
11
|
-
const TradingInfoCardTooltip = ({
|
|
12
|
-
trigger,
|
|
13
|
-
children,
|
|
14
|
-
}: TradingInfoCardTooltipProps) => {
|
|
15
|
-
const theme = useTheme();
|
|
16
|
-
return (
|
|
17
|
-
<Tooltip
|
|
18
|
-
offsetOptions={0}
|
|
19
|
-
enableHover={true}
|
|
20
|
-
enableClick={false}
|
|
21
|
-
arrowProps={{
|
|
22
|
-
width: 18,
|
|
23
|
-
height: 3,
|
|
24
|
-
fill: theme.colors.greyGraphite,
|
|
25
|
-
}}>
|
|
26
|
-
<TooltipTrigger>
|
|
27
|
-
<div data-testid="tooltip-trigger">{trigger}</div>
|
|
28
|
-
</TooltipTrigger>
|
|
29
|
-
<TooltipContent
|
|
30
|
-
css={css`
|
|
31
|
-
padding: 4px 5px;
|
|
32
|
-
border-radius: 2px;
|
|
33
|
-
background: ${theme.colors.greyGraphite};
|
|
34
|
-
|
|
35
|
-
svg {
|
|
36
|
-
margin-bottom: -1px;
|
|
37
|
-
}
|
|
38
|
-
`}>
|
|
39
|
-
<Typography css={{ fontSize: '12px' }} color={theme.colors.white}>
|
|
40
|
-
{children}
|
|
41
|
-
</Typography>
|
|
42
|
-
</TooltipContent>
|
|
43
|
-
</Tooltip>
|
|
44
|
-
);
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
export default TradingInfoCardTooltip;
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Link } from 'react-router-dom';
|
|
3
|
-
import { Theme, css } from '@emotion/react';
|
|
4
|
-
import { CardBase } from '@ssa-ui-kit/core';
|
|
5
|
-
import { TradingInfoCardWrapperProps } from './types';
|
|
6
|
-
|
|
7
|
-
const infoCardWrapper = (theme: Theme) => css`
|
|
8
|
-
position: relative;
|
|
9
|
-
display: flex;
|
|
10
|
-
flex-direction: column;
|
|
11
|
-
align-items: flex-start;
|
|
12
|
-
width: max-content;
|
|
13
|
-
min-width: 100%;
|
|
14
|
-
background: ${theme.colors.greyLighter};
|
|
15
|
-
padding: 4px 10px;
|
|
16
|
-
border-radius: 6px;
|
|
17
|
-
text-decoration: none;
|
|
18
|
-
cursor: pointer;
|
|
19
|
-
white-space: nowrap;
|
|
20
|
-
box-shadow: none;
|
|
21
|
-
user-select: none;
|
|
22
|
-
|
|
23
|
-
&::before {
|
|
24
|
-
position: absolute;
|
|
25
|
-
top: 0;
|
|
26
|
-
left: 0;
|
|
27
|
-
z-index: -1;
|
|
28
|
-
width: 100%;
|
|
29
|
-
height: 100%;
|
|
30
|
-
box-shadow: 0 10px 40px 0 ${theme.colors.greyShadow};
|
|
31
|
-
content: '';
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
&:active {
|
|
35
|
-
background: ${theme.colors.white};
|
|
36
|
-
|
|
37
|
-
&::before {
|
|
38
|
-
border-radius: 6px;
|
|
39
|
-
box-shadow: 0 10px 40px 0 ${theme.colors.greyShadow24};
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
`;
|
|
43
|
-
|
|
44
|
-
const TradingInfoCardWrapper = ({
|
|
45
|
-
onClick,
|
|
46
|
-
link,
|
|
47
|
-
children,
|
|
48
|
-
}: TradingInfoCardWrapperProps) => {
|
|
49
|
-
return (
|
|
50
|
-
<React.Fragment>
|
|
51
|
-
{link ? (
|
|
52
|
-
<Link to={link} css={infoCardWrapper}>
|
|
53
|
-
{children}
|
|
54
|
-
</Link>
|
|
55
|
-
) : (
|
|
56
|
-
<CardBase
|
|
57
|
-
role={onClick ? 'button' : 'region'}
|
|
58
|
-
tabIndex={onClick ? 0 : -1}
|
|
59
|
-
onClick={() => {
|
|
60
|
-
if (typeof onClick === 'function') {
|
|
61
|
-
onClick();
|
|
62
|
-
}
|
|
63
|
-
}}
|
|
64
|
-
css={infoCardWrapper}>
|
|
65
|
-
{children}
|
|
66
|
-
</CardBase>
|
|
67
|
-
)}
|
|
68
|
-
</React.Fragment>
|
|
69
|
-
);
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
export default TradingInfoCardWrapper;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
export interface TradingInfoCardProps {
|
|
4
|
-
value: React.ReactNode;
|
|
5
|
-
title: string;
|
|
6
|
-
unit?: string;
|
|
7
|
-
icon?: React.ReactNode;
|
|
8
|
-
onClick?: () => void;
|
|
9
|
-
link?: string;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export type TradingInfoContent = Pick<
|
|
13
|
-
TradingInfoCardProps,
|
|
14
|
-
'value' | 'unit' | 'icon'
|
|
15
|
-
>;
|
|
16
|
-
|
|
17
|
-
export type TradingInfoCardWrapperProps = Pick<
|
|
18
|
-
TradingInfoCardProps,
|
|
19
|
-
'onClick' | 'link'
|
|
20
|
-
> & {
|
|
21
|
-
children?: React.ReactNode;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export interface TradingInfoCardTooltipProps {
|
|
25
|
-
trigger: string | number | JSX.Element;
|
|
26
|
-
children: React.ReactNode;
|
|
27
|
-
}
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import { MemoryRouter, Route, Routes } from 'react-router-dom';
|
|
2
|
-
import userEvent from '@testing-library/user-event';
|
|
3
|
-
import { Button } from '@ssa-ui-kit/core';
|
|
4
|
-
import TradingScoreboard from './TradingScoreboard';
|
|
5
|
-
import { defaultBoardArr, linkBoardArr } from './helpers';
|
|
6
|
-
|
|
7
|
-
describe('TradingScoreboard', () => {
|
|
8
|
-
it('Renders all items', () => {
|
|
9
|
-
const { getAllByRole, getByRole } = render(
|
|
10
|
-
<TradingScoreboard
|
|
11
|
-
itemsPerRow={5}
|
|
12
|
-
items={defaultBoardArr}
|
|
13
|
-
onClick={(item) => item}
|
|
14
|
-
/>,
|
|
15
|
-
);
|
|
16
|
-
const itemsEls = getAllByRole('button');
|
|
17
|
-
expect(itemsEls.length).toBe(defaultBoardArr.length);
|
|
18
|
-
|
|
19
|
-
for (const item of defaultBoardArr) {
|
|
20
|
-
getByRole('button', { name: new RegExp(item.title, 'i') });
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
it('Renders with Render Prop', () => {
|
|
25
|
-
const { getAllByTestId } = render(
|
|
26
|
-
<TradingScoreboard
|
|
27
|
-
itemsPerRow={5}
|
|
28
|
-
items={defaultBoardArr}
|
|
29
|
-
renderCard={(item) => (
|
|
30
|
-
<Button data-testid="trading-board">
|
|
31
|
-
<span>
|
|
32
|
-
{item.value} {item.unit}
|
|
33
|
-
</span>
|
|
34
|
-
<span>{item.title}</span>
|
|
35
|
-
</Button>
|
|
36
|
-
)}
|
|
37
|
-
/>,
|
|
38
|
-
);
|
|
39
|
-
const itemsEls = getAllByTestId('trading-board');
|
|
40
|
-
expect(itemsEls.length).toBe(defaultBoardArr.length);
|
|
41
|
-
|
|
42
|
-
for (let i = 0; i < itemsEls.length; i++) {
|
|
43
|
-
expect(itemsEls[i]).toHaveTextContent(defaultBoardArr[i].title);
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
it('Calls onClick handlers when clicked', async () => {
|
|
48
|
-
const user = userEvent.setup();
|
|
49
|
-
const mockOnClick = jest.fn();
|
|
50
|
-
|
|
51
|
-
const { getByRole } = render(
|
|
52
|
-
<TradingScoreboard
|
|
53
|
-
itemsPerRow={5}
|
|
54
|
-
items={defaultBoardArr}
|
|
55
|
-
onClick={mockOnClick}
|
|
56
|
-
/>,
|
|
57
|
-
);
|
|
58
|
-
|
|
59
|
-
for (const item of defaultBoardArr) {
|
|
60
|
-
const buttonEl = getByRole('button', {
|
|
61
|
-
name: new RegExp(item.title, 'i'),
|
|
62
|
-
});
|
|
63
|
-
await user.click(buttonEl);
|
|
64
|
-
expect(mockOnClick).toHaveBeenCalledWith(item);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
expect(mockOnClick).toBeCalledTimes(defaultBoardArr.length);
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
it('Renders with link prop', () => {
|
|
71
|
-
const { getByRole } = render(
|
|
72
|
-
<MemoryRouter>
|
|
73
|
-
<Routes>
|
|
74
|
-
<Route
|
|
75
|
-
path="/*"
|
|
76
|
-
element={<TradingScoreboard itemsPerRow={5} items={linkBoardArr} />}
|
|
77
|
-
/>
|
|
78
|
-
</Routes>
|
|
79
|
-
</MemoryRouter>,
|
|
80
|
-
);
|
|
81
|
-
|
|
82
|
-
for (const item of linkBoardArr) {
|
|
83
|
-
getByRole('link', { name: new RegExp(item.title, 'i') });
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
it('Calls onClick handlers with render prop when clicked', async () => {
|
|
88
|
-
const user = userEvent.setup();
|
|
89
|
-
const mockOnClick = jest.fn();
|
|
90
|
-
|
|
91
|
-
const { getAllByTestId } = render(
|
|
92
|
-
<TradingScoreboard
|
|
93
|
-
itemsPerRow={5}
|
|
94
|
-
items={defaultBoardArr}
|
|
95
|
-
onClick={mockOnClick}
|
|
96
|
-
renderCard={(item, onClick) => (
|
|
97
|
-
<Button data-testid="trading-board" onClick={() => onClick?.(item)}>
|
|
98
|
-
<span>
|
|
99
|
-
{item.value} {item.unit}
|
|
100
|
-
</span>
|
|
101
|
-
<span>
|
|
102
|
-
{item.title} {item.icon}
|
|
103
|
-
</span>
|
|
104
|
-
</Button>
|
|
105
|
-
)}
|
|
106
|
-
/>,
|
|
107
|
-
);
|
|
108
|
-
|
|
109
|
-
const itemsEls = getAllByTestId('trading-board');
|
|
110
|
-
expect(itemsEls.length).toBe(defaultBoardArr.length);
|
|
111
|
-
|
|
112
|
-
for (let i = 0; i < itemsEls.length; i++) {
|
|
113
|
-
await user.click(itemsEls[i]);
|
|
114
|
-
expect(mockOnClick).toHaveBeenCalledWith(defaultBoardArr[i]);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
expect(mockOnClick).toBeCalledTimes(defaultBoardArr.length);
|
|
118
|
-
});
|
|
119
|
-
});
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import { MemoryRouter, Route, Routes } from 'react-router-dom';
|
|
2
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
-
import { css } from '@emotion/react';
|
|
4
|
-
import { Button } from '@ssa-ui-kit/core';
|
|
5
|
-
import TradingScoreboard from './TradingScoreboard';
|
|
6
|
-
import { TradingScoreboardProps } from './types';
|
|
7
|
-
import { defaultBoardArr, linkBoardArr, oneLineBoardArr } from './helpers';
|
|
8
|
-
|
|
9
|
-
export default {
|
|
10
|
-
title: 'Trading/TradingScoreboard',
|
|
11
|
-
component: TradingScoreboard,
|
|
12
|
-
} as Meta<typeof TradingScoreboard>;
|
|
13
|
-
|
|
14
|
-
export const Default: StoryObj<typeof TradingScoreboard> = (
|
|
15
|
-
args: TradingScoreboardProps,
|
|
16
|
-
) => {
|
|
17
|
-
return (
|
|
18
|
-
<TradingScoreboard
|
|
19
|
-
items={args.items}
|
|
20
|
-
itemsPerRow={args.itemsPerRow}
|
|
21
|
-
onClick={() => alert('clicked!')}
|
|
22
|
-
css={css`
|
|
23
|
-
gap: 4px;
|
|
24
|
-
`}
|
|
25
|
-
/>
|
|
26
|
-
);
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
Default.args = {
|
|
30
|
-
itemsPerRow: 5,
|
|
31
|
-
items: defaultBoardArr,
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
export const OneLine: StoryObj<typeof TradingScoreboard> = (
|
|
35
|
-
args: TradingScoreboardProps,
|
|
36
|
-
) => {
|
|
37
|
-
return (
|
|
38
|
-
<TradingScoreboard
|
|
39
|
-
items={args.items}
|
|
40
|
-
itemsPerRow={args.itemsPerRow}
|
|
41
|
-
onClick={() => alert('clicked!')}
|
|
42
|
-
css={css`
|
|
43
|
-
gap: 4px;
|
|
44
|
-
`}
|
|
45
|
-
/>
|
|
46
|
-
);
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
OneLine.args = {
|
|
50
|
-
itemsPerRow: 7,
|
|
51
|
-
items: oneLineBoardArr,
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
export const WithCustomComponent: StoryObj<typeof TradingScoreboard> = (
|
|
55
|
-
args: TradingScoreboardProps,
|
|
56
|
-
) => {
|
|
57
|
-
return (
|
|
58
|
-
<TradingScoreboard
|
|
59
|
-
items={args.items}
|
|
60
|
-
itemsPerRow={args.itemsPerRow}
|
|
61
|
-
renderCard={(item, onClick) => (
|
|
62
|
-
<Button
|
|
63
|
-
css={{
|
|
64
|
-
display: 'flex',
|
|
65
|
-
flexDirection: 'column',
|
|
66
|
-
alignItems: 'flex-start',
|
|
67
|
-
width: '100%',
|
|
68
|
-
height: 'auto',
|
|
69
|
-
padding: '10px',
|
|
70
|
-
boxShadow: 'none',
|
|
71
|
-
}}
|
|
72
|
-
variant="secondary"
|
|
73
|
-
onClick={() => onClick?.(item)}>
|
|
74
|
-
<span css={{ fontWeight: '600' }}>
|
|
75
|
-
{item.value} {item.unit}
|
|
76
|
-
</span>
|
|
77
|
-
<span>{item.title}</span>
|
|
78
|
-
</Button>
|
|
79
|
-
)}
|
|
80
|
-
css={css`
|
|
81
|
-
gap: 4px;
|
|
82
|
-
color: white;
|
|
83
|
-
`}
|
|
84
|
-
/>
|
|
85
|
-
);
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
WithCustomComponent.args = {
|
|
89
|
-
itemsPerRow: 7,
|
|
90
|
-
items: oneLineBoardArr,
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
export const WithLink: StoryObj<typeof TradingScoreboard> = (
|
|
94
|
-
args: TradingScoreboardProps,
|
|
95
|
-
) => {
|
|
96
|
-
return (
|
|
97
|
-
<MemoryRouter>
|
|
98
|
-
<Routes>
|
|
99
|
-
<Route
|
|
100
|
-
path={'/*'}
|
|
101
|
-
element={
|
|
102
|
-
<TradingScoreboard
|
|
103
|
-
items={args.items}
|
|
104
|
-
itemsPerRow={args.itemsPerRow}
|
|
105
|
-
css={css`
|
|
106
|
-
gap: 4px;
|
|
107
|
-
`}
|
|
108
|
-
/>
|
|
109
|
-
}
|
|
110
|
-
/>
|
|
111
|
-
</Routes>
|
|
112
|
-
</MemoryRouter>
|
|
113
|
-
);
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
WithLink.args = {
|
|
117
|
-
itemsPerRow: 7,
|
|
118
|
-
items: linkBoardArr,
|
|
119
|
-
};
|