@wakastellar/ui 2.3.4 → 2.4.0
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/blocks/dashboard/index.d.ts +4 -1
- package/dist/blocks/empty-states/index.d.ts +4 -1
- package/dist/blocks/error-pages/index.d.ts +4 -1
- package/dist/blocks/index.d.ts +1 -1
- package/dist/blocks/landing/index.d.ts +4 -1
- package/dist/blocks/pricing/index.d.ts +5 -1
- package/dist/blocks/sidebar/index.d.ts +5 -1
- package/dist/index.cjs.js +130 -130
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +7905 -7856
- package/dist/stories/Button.d.ts +14 -0
- package/dist/stories/Button.stories.d.ts +8 -0
- package/dist/stories/Header.d.ts +11 -0
- package/dist/stories/Header.stories.d.ts +6 -0
- package/dist/stories/Page.d.ts +2 -0
- package/dist/stories/Page.stories.d.ts +6 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/link.d.ts +23 -0
- package/package.json +11 -3
- package/src/blocks/activity-timeline/ActivityTimeline.stories.tsx +460 -0
- package/src/blocks/apm-overview/APMOverview.stories.tsx +435 -0
- package/src/blocks/auth-2fa/Auth2FA.stories.tsx +308 -0
- package/src/blocks/calendar-view/CalendarView.stories.tsx +398 -0
- package/src/blocks/chat/Chat.stories.tsx +466 -0
- package/src/blocks/chat-interface/ChatInterface.stories.tsx +412 -0
- package/src/blocks/checkout-flow/CheckoutFlow.stories.tsx +408 -0
- package/src/blocks/cicd-builder/CICDBuilder.stories.tsx +499 -0
- package/src/blocks/cloud-cost-dashboard/CloudCostDashboard.stories.tsx +356 -0
- package/src/blocks/container-orchestrator/ContainerOrchestrator.stories.tsx +461 -0
- package/src/blocks/dashboard/Dashboard.stories.tsx +559 -0
- package/src/blocks/dashboard/index.tsx +68 -27
- package/src/blocks/dashboard-kpi/DashboardKPI.stories.tsx +422 -0
- package/src/blocks/database-admin/DatabaseAdmin.stories.tsx +393 -0
- package/src/blocks/deployment-dashboard/DeploymentDashboard.stories.tsx +457 -0
- package/src/blocks/empty-states/EmptyStates.stories.tsx +467 -0
- package/src/blocks/empty-states/index.tsx +26 -8
- package/src/blocks/error-pages/ErrorPages.stories.tsx +401 -0
- package/src/blocks/error-pages/index.tsx +26 -8
- package/src/blocks/faq/FAQ.stories.tsx +416 -0
- package/src/blocks/file-manager/FileManager.stories.tsx +413 -0
- package/src/blocks/footer/Footer.stories.tsx +328 -0
- package/src/blocks/gitops-sync-status/GitOpsSyncStatus.stories.tsx +529 -0
- package/src/blocks/header/WakaHeader.stories.tsx +455 -0
- package/src/blocks/headtab/Headtab.stories.tsx +369 -0
- package/src/blocks/i18n-editor/I18nEditor.stories.tsx +451 -0
- package/src/blocks/incident-manager/IncidentManager.stories.tsx +464 -0
- package/src/blocks/index.ts +1 -1
- package/src/blocks/infrastructure-map/InfrastructureMap.stories.tsx +533 -0
- package/src/blocks/kanban-board/KanbanBoard.stories.tsx +494 -0
- package/src/blocks/landing/WakaLanding.stories.tsx +449 -0
- package/src/blocks/landing/index.tsx +125 -66
- package/src/blocks/language-selector/LanguageSelector.stories.tsx +345 -0
- package/src/blocks/layout/Layout.stories.tsx +373 -0
- package/src/blocks/login/Login.stories.tsx +443 -0
- package/src/blocks/on-call-schedule/OnCallSchedule.stories.tsx +381 -0
- package/src/blocks/player-profile/PlayerProfile.stories.tsx +316 -0
- package/src/blocks/pricing/WakaPricing.stories.tsx +530 -0
- package/src/blocks/pricing/index.tsx +38 -4
- package/src/blocks/profile/Profile.stories.tsx +371 -0
- package/src/blocks/release-notes/ReleaseNotes.stories.tsx +431 -0
- package/src/blocks/settings/Settings.stories.tsx +520 -0
- package/src/blocks/sidebar/WakaSidebar.stories.tsx +513 -0
- package/src/blocks/sidebar/index.tsx +49 -20
- package/src/blocks/theme-creator-block/ThemeCreatorBlock.stories.tsx +370 -0
- package/src/blocks/user-management/UserManagement.stories.tsx +411 -0
- package/src/blocks/wizard/Wizard.stories.tsx +683 -0
- package/src/components/accordion/Accordion.stories.tsx +93 -0
- package/src/components/alert/Alert.stories.tsx +95 -0
- package/src/components/alert-dialog/AlertDialog.stories.tsx +126 -0
- package/src/components/aspect-ratio/AspectRatio.stories.tsx +118 -0
- package/src/components/avatar/Avatar.stories.tsx +104 -0
- package/src/components/button/Button.stories.tsx +12 -1
- package/src/components/calendar/Calendar.stories.tsx +102 -0
- package/src/components/card/Card.stories.tsx +125 -0
- package/src/components/checkbox/Checkbox.stories.tsx +100 -0
- package/src/components/code/Code.stories.tsx +402 -0
- package/src/components/collapsible/Collapsible.stories.tsx +123 -0
- package/src/components/command/Command.stories.tsx +207 -0
- package/src/components/context-menu/ContextMenu.stories.tsx +220 -0
- package/src/components/dialog/Dialog.stories.tsx +157 -0
- package/src/components/dropdown-menu/DropdownMenu.stories.tsx +225 -0
- package/src/components/form/Form.stories.tsx +413 -0
- package/src/components/hover-card/HoverCard.stories.tsx +148 -0
- package/src/components/input-otp/InputOTP.stories.tsx +255 -0
- package/src/components/label/Label.stories.tsx +68 -0
- package/src/components/menubar/Menubar.stories.tsx +278 -0
- package/src/components/navigation-menu/NavigationMenu.stories.tsx +202 -0
- package/src/components/popover/Popover.stories.tsx +199 -0
- package/src/components/progress/Progress.stories.tsx +104 -0
- package/src/components/radio-group/RadioGroup.stories.tsx +138 -0
- package/src/components/scroll-area/ScrollArea.stories.tsx +153 -0
- package/src/components/select/Select.stories.tsx +146 -0
- package/src/components/separator/Separator.stories.tsx +117 -0
- package/src/components/sheet/Sheet.stories.tsx +195 -0
- package/src/components/skeleton/Skeleton.stories.tsx +114 -0
- package/src/components/slider/Slider.stories.tsx +157 -0
- package/src/components/switch/Switch.stories.tsx +114 -0
- package/src/components/table/Table.stories.tsx +153 -0
- package/src/components/tabs/Tabs.stories.tsx +155 -0
- package/src/components/textarea/Textarea.stories.tsx +116 -0
- package/src/components/toast/Toast.stories.tsx +160 -0
- package/src/components/toggle/Toggle.stories.tsx +125 -0
- package/src/components/tooltip/Tooltip.stories.tsx +133 -0
- package/src/components/typography/Typography.stories.tsx +207 -0
- package/src/components/waka-3d-pie-chart/Waka3DPieChart.stories.tsx +308 -0
- package/src/components/waka-achievement-unlock/WakaAchievementUnlock.stories.tsx +353 -0
- package/src/components/waka-artifact-list/WakaArtifactList.stories.tsx +258 -0
- package/src/components/waka-autocomplete/WakaAutocomplete.stories.tsx +224 -0
- package/src/components/waka-badge-showcase/WakaBadgeShowcase.stories.tsx +269 -0
- package/src/components/waka-barcode/WakaBarcode.stories.tsx +227 -0
- package/src/components/waka-bottom-sheet/WakaBottomSheet.stories.tsx +408 -0
- package/src/components/waka-breadcrumb/WakaBreadcrumb.stories.tsx +237 -0
- package/src/components/waka-build-matrix/WakaBuildMatrix.stories.tsx +328 -0
- package/src/components/waka-carousel/WakaCarousel.stories.tsx +296 -0
- package/src/components/waka-charts/WakaCharts.stories.tsx +519 -0
- package/src/components/waka-color-picker/WakaColorPicker.stories.tsx +200 -0
- package/src/components/waka-combobox/WakaCombobox.stories.tsx +250 -0
- package/src/components/waka-container-list/WakaContainerList.stories.tsx +315 -0
- package/src/components/waka-contribution-graph/WakaContributionGraph.stories.tsx +354 -0
- package/src/components/waka-cost-breakdown/WakaCostBreakdown.stories.tsx +348 -0
- package/src/components/waka-daily-reward/WakaDailyReward.stories.tsx +365 -0
- package/src/components/waka-database-card/WakaDatabaseCard.stories.tsx +306 -0
- package/src/components/waka-date-range-picker/WakaDateRangePicker.stories.tsx +339 -0
- package/src/components/waka-datetime-picker/WakaDateTimePicker.stories.tsx +317 -0
- package/src/components/waka-deployment-lane/WakaDeploymentLane.stories.tsx +292 -0
- package/src/components/waka-dock/WakaDock.stories.tsx +332 -0
- package/src/components/waka-drawer/WakaDrawer.stories.tsx +437 -0
- package/src/components/waka-env-var-editor/WakaEnvVarEditor.stories.tsx +263 -0
- package/src/components/waka-error-shake/WakaErrorShake.stories.tsx +410 -0
- package/src/components/waka-file-upload/WakaFileUpload.stories.tsx +239 -0
- package/src/components/waka-flow-diagram/WakaFlowDiagram.stories.tsx +365 -0
- package/src/components/waka-funnel-chart/WakaFunnelChart.stories.tsx +281 -0
- package/src/components/waka-glow-card/WakaGlowCard.stories.tsx +274 -0
- package/src/components/waka-haptic-button/WakaHapticButton.stories.tsx +349 -0
- package/src/components/waka-health-pulse/WakaHealthPulse.stories.tsx +293 -0
- package/src/components/waka-heatmap/WakaHeatmap.stories.tsx +376 -0
- package/src/components/waka-image/WakaImage.stories.tsx +255 -0
- package/src/components/waka-incident-timeline/WakaIncidentTimeline.stories.tsx +300 -0
- package/src/components/waka-kanban/WakaKanban.stories.tsx +399 -0
- package/src/components/waka-kubernetes-overview/WakaKubernetesOverview.stories.tsx +281 -0
- package/src/components/waka-leaderboard/WakaLeaderboard.stories.tsx +300 -0
- package/src/components/waka-level-progress/WakaLevelProgress.stories.tsx +313 -0
- package/src/components/waka-loading-orbit/WakaLoadingOrbit.stories.tsx +413 -0
- package/src/components/waka-log-viewer/WakaLogViewer.stories.tsx +312 -0
- package/src/components/waka-loot-box/WakaLootBox.stories.tsx +374 -0
- package/src/components/waka-metric-sparkline/WakaMetricSparkline.stories.tsx +312 -0
- package/src/components/waka-migration-list/WakaMigrationList.stories.tsx +289 -0
- package/src/components/waka-modal/WakaModal.stories.tsx +434 -0
- package/src/components/waka-morph-button/WakaMorphButton.stories.tsx +405 -0
- package/src/components/waka-network-topology/WakaNetworkTopology.stories.tsx +364 -0
- package/src/components/waka-notifications/WakaNotifications.stories.tsx +290 -0
- package/src/components/waka-number-input/WakaNumberInput.stories.tsx +282 -0
- package/src/components/waka-pagination/WakaPagination.stories.tsx +328 -0
- package/src/components/waka-password-strength/WakaPasswordStrength.stories.tsx +318 -0
- package/src/components/waka-pipeline-view/WakaPipelineView.stories.tsx +386 -0
- package/src/components/waka-player-card/WakaPlayerCard.stories.tsx +333 -0
- package/src/components/waka-pod-card/WakaPodCard.stories.tsx +435 -0
- package/src/components/waka-qrcode/WakaQRCode.stories.tsx +232 -0
- package/src/components/waka-query-explain/WakaQueryExplain.stories.tsx +407 -0
- package/src/components/waka-quest-card/WakaQuestCard.stories.tsx +394 -0
- package/src/components/waka-quota-bar/WakaQuotaBar.stories.tsx +435 -0
- package/src/components/waka-radar-score/WakaRadarScore.stories.tsx +372 -0
- package/src/components/waka-resource-gauge/WakaResourceGauge.stories.tsx +366 -0
- package/src/components/waka-rich-text-editor/WakaRichTextEditor.stories.tsx +238 -0
- package/src/components/waka-sankey-diagram/WakaSankeyDiagram.stories.tsx +389 -0
- package/src/components/waka-scratch-card/WakaScratchCard.stories.tsx +388 -0
- package/src/components/waka-secret-card/WakaSecretCard.stories.tsx +314 -0
- package/src/components/waka-segmented-control/WakaSegmentedControl.stories.tsx +309 -0
- package/src/components/waka-server-rack/WakaServerRack.stories.tsx +382 -0
- package/src/components/waka-service-graph/WakaServiceGraph.stories.tsx +262 -0
- package/src/components/waka-skeleton-wave/WakaSkeletonWave.stories.tsx +321 -0
- package/src/components/waka-skill-tree/WakaSkillTree.stories.tsx +308 -0
- package/src/components/waka-spin-wheel/WakaSpinWheel.stories.tsx +368 -0
- package/src/components/waka-spinner/WakaSpinner.stories.tsx +156 -0
- package/src/components/waka-stat/WakaStat.stories.tsx +334 -0
- package/src/components/waka-status-matrix/WakaStatusMatrix.stories.tsx +331 -0
- package/src/components/waka-stepper/WakaStepper.stories.tsx +468 -0
- package/src/components/waka-streak-counter/WakaStreakCounter.stories.tsx +235 -0
- package/src/components/waka-success-explosion/WakaSuccessExplosion.stories.tsx +389 -0
- package/src/components/waka-tabs-morph/WakaTabsMorph.stories.tsx +471 -0
- package/src/components/waka-terminal-output/WakaTerminalOutput.stories.tsx +351 -0
- package/src/components/waka-test-report/WakaTestReport.stories.tsx +322 -0
- package/src/components/waka-tilt-card/WakaTiltCard.stories.tsx +300 -0
- package/src/components/waka-time-picker/WakaTimePicker.stories.tsx +227 -0
- package/src/components/waka-timeline/WakaTimeline.stories.tsx +383 -0
- package/src/components/waka-tournament-bracket/WakaTournamentBracket.stories.tsx +375 -0
- package/src/components/waka-trace-viewer/WakaTraceViewer.stories.tsx +445 -0
- package/src/components/waka-tree/WakaTree.stories.tsx +359 -0
- package/src/components/waka-treemap-chart/WakaTreemapChart.stories.tsx +378 -0
- package/src/components/waka-typewriter/WakaTypewriter.stories.tsx +366 -0
- package/src/components/waka-versus-card/WakaVersusCard.stories.tsx +530 -0
- package/src/components/waka-video/WakaVideo.stories.tsx +203 -0
- package/src/components/waka-virtual-list/WakaVirtualList.stories.tsx +273 -0
- package/src/components/waka-xp-bar/WakaXPBar.stories.tsx +305 -0
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
2
|
+
import { WakaXPBar, useXPBar } from './index'
|
|
3
|
+
import * as React from 'react'
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof WakaXPBar> = {
|
|
6
|
+
title: 'Components/Gamification/WakaXPBar',
|
|
7
|
+
component: WakaXPBar,
|
|
8
|
+
parameters: {
|
|
9
|
+
layout: 'centered',
|
|
10
|
+
docs: {
|
|
11
|
+
description: {
|
|
12
|
+
component: 'An experience points progress bar with particle effects, level badges, and celebratory animations.',
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
tags: ['autodocs'],
|
|
17
|
+
argTypes: {
|
|
18
|
+
currentXP: {
|
|
19
|
+
control: { type: 'range', min: 0, max: 10000, step: 100 },
|
|
20
|
+
description: 'Current XP value',
|
|
21
|
+
},
|
|
22
|
+
requiredXP: {
|
|
23
|
+
control: { type: 'range', min: 1000, max: 20000, step: 1000 },
|
|
24
|
+
description: 'XP required for next level',
|
|
25
|
+
},
|
|
26
|
+
level: {
|
|
27
|
+
control: { type: 'number', min: 1, max: 100 },
|
|
28
|
+
description: 'Current level',
|
|
29
|
+
},
|
|
30
|
+
size: {
|
|
31
|
+
control: 'select',
|
|
32
|
+
options: ['sm', 'md', 'lg'],
|
|
33
|
+
description: 'Size variant',
|
|
34
|
+
},
|
|
35
|
+
showParticles: {
|
|
36
|
+
control: 'boolean',
|
|
37
|
+
description: 'Show particle effects',
|
|
38
|
+
},
|
|
39
|
+
showLevel: {
|
|
40
|
+
control: 'boolean',
|
|
41
|
+
description: 'Show level badge',
|
|
42
|
+
},
|
|
43
|
+
showXPCount: {
|
|
44
|
+
control: 'boolean',
|
|
45
|
+
description: 'Show XP count display',
|
|
46
|
+
},
|
|
47
|
+
animated: {
|
|
48
|
+
control: 'boolean',
|
|
49
|
+
description: 'Enable animations',
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export default meta
|
|
55
|
+
type Story = StoryObj<typeof WakaXPBar>
|
|
56
|
+
|
|
57
|
+
export const Default: Story = {
|
|
58
|
+
args: {
|
|
59
|
+
currentXP: 2500,
|
|
60
|
+
requiredXP: 5000,
|
|
61
|
+
level: 5,
|
|
62
|
+
size: 'md',
|
|
63
|
+
showParticles: false,
|
|
64
|
+
showLevel: true,
|
|
65
|
+
showXPCount: true,
|
|
66
|
+
animated: true,
|
|
67
|
+
},
|
|
68
|
+
render: (args) => (
|
|
69
|
+
<div className="w-[400px]">
|
|
70
|
+
<WakaXPBar {...args} />
|
|
71
|
+
</div>
|
|
72
|
+
),
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export const Variants: Story = {
|
|
76
|
+
render: () => (
|
|
77
|
+
<div className="w-[400px] space-y-6">
|
|
78
|
+
<div>
|
|
79
|
+
<p className="text-sm text-muted-foreground mb-2">Default</p>
|
|
80
|
+
<WakaXPBar currentXP={1500} maxXP={3000} level={3} variant="default" />
|
|
81
|
+
</div>
|
|
82
|
+
<div>
|
|
83
|
+
<p className="text-sm text-muted-foreground mb-2">Gradient</p>
|
|
84
|
+
<WakaXPBar currentXP={2000} maxXP={3000} level={5} variant="gradient" />
|
|
85
|
+
</div>
|
|
86
|
+
<div>
|
|
87
|
+
<p className="text-sm text-muted-foreground mb-2">Glow</p>
|
|
88
|
+
<WakaXPBar currentXP={2800} maxXP={3000} level={8} variant="glow" />
|
|
89
|
+
</div>
|
|
90
|
+
<div>
|
|
91
|
+
<p className="text-sm text-muted-foreground mb-2">Minimal</p>
|
|
92
|
+
<WakaXPBar currentXP={1200} maxXP={3000} level={2} variant="minimal" />
|
|
93
|
+
</div>
|
|
94
|
+
</div>
|
|
95
|
+
),
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export const Sizes: Story = {
|
|
99
|
+
render: () => (
|
|
100
|
+
<div className="w-[400px] space-y-6">
|
|
101
|
+
<div>
|
|
102
|
+
<p className="text-sm text-muted-foreground mb-2">Small</p>
|
|
103
|
+
<WakaXPBar currentXP={1500} maxXP={3000} level={3} size="sm" />
|
|
104
|
+
</div>
|
|
105
|
+
<div>
|
|
106
|
+
<p className="text-sm text-muted-foreground mb-2">Medium (Default)</p>
|
|
107
|
+
<WakaXPBar currentXP={2000} maxXP={3000} level={5} size="md" />
|
|
108
|
+
</div>
|
|
109
|
+
<div>
|
|
110
|
+
<p className="text-sm text-muted-foreground mb-2">Large</p>
|
|
111
|
+
<WakaXPBar currentXP={2500} maxXP={3000} level={8} size="lg" />
|
|
112
|
+
</div>
|
|
113
|
+
</div>
|
|
114
|
+
),
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export const ProgressStates: Story = {
|
|
118
|
+
render: () => (
|
|
119
|
+
<div className="w-[400px] space-y-6">
|
|
120
|
+
<div>
|
|
121
|
+
<p className="text-sm text-muted-foreground mb-2">Just Started (10%)</p>
|
|
122
|
+
<WakaXPBar currentXP={300} maxXP={3000} level={1} />
|
|
123
|
+
</div>
|
|
124
|
+
<div>
|
|
125
|
+
<p className="text-sm text-muted-foreground mb-2">Halfway (50%)</p>
|
|
126
|
+
<WakaXPBar currentXP={1500} maxXP={3000} level={5} />
|
|
127
|
+
</div>
|
|
128
|
+
<div>
|
|
129
|
+
<p className="text-sm text-muted-foreground mb-2">Almost There (90%)</p>
|
|
130
|
+
<WakaXPBar currentXP={2700} maxXP={3000} level={9} />
|
|
131
|
+
</div>
|
|
132
|
+
<div>
|
|
133
|
+
<p className="text-sm text-muted-foreground mb-2">Max Level Ready</p>
|
|
134
|
+
<WakaXPBar currentXP={3000} maxXP={3000} level={10} />
|
|
135
|
+
</div>
|
|
136
|
+
</div>
|
|
137
|
+
),
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export const WithParticles: Story = {
|
|
141
|
+
render: () => (
|
|
142
|
+
<div className="w-[400px] space-y-6">
|
|
143
|
+
<div>
|
|
144
|
+
<p className="text-sm text-muted-foreground mb-2">With Particles</p>
|
|
145
|
+
<WakaXPBar currentXP={2500} maxXP={3000} level={7} showParticles />
|
|
146
|
+
</div>
|
|
147
|
+
<div>
|
|
148
|
+
<p className="text-sm text-muted-foreground mb-2">Without Particles</p>
|
|
149
|
+
<WakaXPBar currentXP={2500} maxXP={3000} level={7} showParticles={false} />
|
|
150
|
+
</div>
|
|
151
|
+
</div>
|
|
152
|
+
),
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export const Interactive: Story = {
|
|
156
|
+
render: () => {
|
|
157
|
+
const [xp, setXp] = React.useState(1000)
|
|
158
|
+
const maxXP = 5000
|
|
159
|
+
const level = Math.floor(xp / 1000) + 1
|
|
160
|
+
|
|
161
|
+
return (
|
|
162
|
+
<div className="w-[400px] space-y-4">
|
|
163
|
+
<WakaXPBar currentXP={xp} maxXP={maxXP} level={level} showParticles animated />
|
|
164
|
+
<div className="flex gap-2">
|
|
165
|
+
<button
|
|
166
|
+
onClick={() => setXp((prev) => Math.min(prev + 500, maxXP))}
|
|
167
|
+
className="px-4 py-2 rounded-lg bg-primary text-primary-foreground font-medium hover:bg-primary/90"
|
|
168
|
+
>
|
|
169
|
+
+500 XP
|
|
170
|
+
</button>
|
|
171
|
+
<button
|
|
172
|
+
onClick={() => setXp((prev) => Math.max(prev - 500, 0))}
|
|
173
|
+
className="px-4 py-2 rounded-lg bg-muted text-muted-foreground font-medium hover:bg-muted/80"
|
|
174
|
+
>
|
|
175
|
+
-500 XP
|
|
176
|
+
</button>
|
|
177
|
+
<button
|
|
178
|
+
onClick={() => setXp(0)}
|
|
179
|
+
className="px-4 py-2 rounded-lg border font-medium hover:bg-muted"
|
|
180
|
+
>
|
|
181
|
+
Reset
|
|
182
|
+
</button>
|
|
183
|
+
</div>
|
|
184
|
+
<p className="text-sm text-muted-foreground text-center">
|
|
185
|
+
Level {level} • {xp.toLocaleString()} / {maxXP.toLocaleString()} XP
|
|
186
|
+
</p>
|
|
187
|
+
</div>
|
|
188
|
+
)
|
|
189
|
+
},
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
export const WithHook: Story = {
|
|
193
|
+
render: () => {
|
|
194
|
+
const { currentXP, maxXP, level, percentage, addXP, reset, levelUp } = useXPBar({
|
|
195
|
+
initialXP: 1500,
|
|
196
|
+
initialMaxXP: 3000,
|
|
197
|
+
initialLevel: 3,
|
|
198
|
+
})
|
|
199
|
+
|
|
200
|
+
return (
|
|
201
|
+
<div className="w-[400px] space-y-4">
|
|
202
|
+
<WakaXPBar currentXP={currentXP} maxXP={maxXP} level={level} variant="gradient" showParticles />
|
|
203
|
+
|
|
204
|
+
<div className="grid grid-cols-3 gap-2 text-center">
|
|
205
|
+
<div className="p-3 rounded-lg border">
|
|
206
|
+
<p className="text-2xl font-bold">{level}</p>
|
|
207
|
+
<p className="text-xs text-muted-foreground">Level</p>
|
|
208
|
+
</div>
|
|
209
|
+
<div className="p-3 rounded-lg border">
|
|
210
|
+
<p className="text-2xl font-bold">{currentXP.toLocaleString()}</p>
|
|
211
|
+
<p className="text-xs text-muted-foreground">Current XP</p>
|
|
212
|
+
</div>
|
|
213
|
+
<div className="p-3 rounded-lg border">
|
|
214
|
+
<p className="text-2xl font-bold">{Math.round(percentage)}%</p>
|
|
215
|
+
<p className="text-xs text-muted-foreground">Progress</p>
|
|
216
|
+
</div>
|
|
217
|
+
</div>
|
|
218
|
+
|
|
219
|
+
<div className="flex gap-2 flex-wrap">
|
|
220
|
+
<button
|
|
221
|
+
onClick={() => addXP(100)}
|
|
222
|
+
className="px-3 py-1.5 text-sm rounded bg-green-500 text-white hover:bg-green-600"
|
|
223
|
+
>
|
|
224
|
+
+100 XP
|
|
225
|
+
</button>
|
|
226
|
+
<button
|
|
227
|
+
onClick={() => addXP(500)}
|
|
228
|
+
className="px-3 py-1.5 text-sm rounded bg-blue-500 text-white hover:bg-blue-600"
|
|
229
|
+
>
|
|
230
|
+
+500 XP
|
|
231
|
+
</button>
|
|
232
|
+
<button
|
|
233
|
+
onClick={levelUp}
|
|
234
|
+
className="px-3 py-1.5 text-sm rounded bg-purple-500 text-white hover:bg-purple-600"
|
|
235
|
+
>
|
|
236
|
+
Level Up
|
|
237
|
+
</button>
|
|
238
|
+
<button
|
|
239
|
+
onClick={reset}
|
|
240
|
+
className="px-3 py-1.5 text-sm rounded border hover:bg-muted"
|
|
241
|
+
>
|
|
242
|
+
Reset
|
|
243
|
+
</button>
|
|
244
|
+
</div>
|
|
245
|
+
</div>
|
|
246
|
+
)
|
|
247
|
+
},
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
export const GamerProfile: Story = {
|
|
251
|
+
render: () => (
|
|
252
|
+
<div className="w-[450px] p-6 rounded-xl border bg-gradient-to-br from-background to-muted/30">
|
|
253
|
+
<div className="flex items-center gap-4 mb-6">
|
|
254
|
+
<div className="w-16 h-16 rounded-full bg-gradient-to-br from-violet-500 to-purple-600 flex items-center justify-center text-white font-bold text-xl">
|
|
255
|
+
JD
|
|
256
|
+
</div>
|
|
257
|
+
<div>
|
|
258
|
+
<h3 className="text-xl font-bold">JaneDoe_42</h3>
|
|
259
|
+
<p className="text-sm text-muted-foreground">Legendary Player</p>
|
|
260
|
+
</div>
|
|
261
|
+
<div className="ml-auto text-right">
|
|
262
|
+
<p className="text-sm text-muted-foreground">Rank</p>
|
|
263
|
+
<p className="text-lg font-bold text-amber-500">#127</p>
|
|
264
|
+
</div>
|
|
265
|
+
</div>
|
|
266
|
+
|
|
267
|
+
<WakaXPBar currentXP={8750} maxXP={10000} level={42} variant="glow" showParticles />
|
|
268
|
+
|
|
269
|
+
<div className="mt-6 grid grid-cols-3 gap-4 text-center">
|
|
270
|
+
<div className="p-3 rounded-lg bg-muted/50">
|
|
271
|
+
<p className="text-2xl font-bold">1,247</p>
|
|
272
|
+
<p className="text-xs text-muted-foreground">Games Won</p>
|
|
273
|
+
</div>
|
|
274
|
+
<div className="p-3 rounded-lg bg-muted/50">
|
|
275
|
+
<p className="text-2xl font-bold">89%</p>
|
|
276
|
+
<p className="text-xs text-muted-foreground">Win Rate</p>
|
|
277
|
+
</div>
|
|
278
|
+
<div className="p-3 rounded-lg bg-muted/50">
|
|
279
|
+
<p className="text-2xl font-bold">156</p>
|
|
280
|
+
<p className="text-xs text-muted-foreground">Achievements</p>
|
|
281
|
+
</div>
|
|
282
|
+
</div>
|
|
283
|
+
</div>
|
|
284
|
+
),
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
export const NoAnimation: Story = {
|
|
288
|
+
render: () => (
|
|
289
|
+
<div className="w-[400px]">
|
|
290
|
+
<WakaXPBar currentXP={2500} maxXP={5000} level={5} animated={false} showParticles={false} />
|
|
291
|
+
</div>
|
|
292
|
+
),
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
export const CompactWidget: Story = {
|
|
296
|
+
render: () => (
|
|
297
|
+
<div className="w-[250px] p-4 rounded-lg border bg-card">
|
|
298
|
+
<div className="flex items-center justify-between mb-2">
|
|
299
|
+
<span className="text-sm font-medium">Your Progress</span>
|
|
300
|
+
<span className="text-xs text-muted-foreground">Lv. 12</span>
|
|
301
|
+
</div>
|
|
302
|
+
<WakaXPBar currentXP={2200} maxXP={3000} level={12} size="sm" variant="minimal" />
|
|
303
|
+
</div>
|
|
304
|
+
),
|
|
305
|
+
}
|