From 9f44c8896b8916e5e0952114ec03d88c7705d7e8 Mon Sep 17 00:00:00 2001 From: Graeme Houston Date: Fri, 31 Jan 2025 15:44:40 +0000 Subject: [PATCH] docs: (BadgeTile) update docs to reflect recnt changes --- docs/components/badge-tile.md | 49 +++++++++++++++++++++-------------- 1 file changed, 30 insertions(+), 19 deletions(-) diff --git a/docs/components/badge-tile.md b/docs/components/badge-tile.md index 6f131dc..7f16922 100644 --- a/docs/components/badge-tile.md +++ b/docs/components/badge-tile.md @@ -1,6 +1,6 @@ # Badge Tile -Displays achievement badges with support for latest earned, specific badges, and multiple achievement states. +Displays achievement badges with support for latest earned and specific badges. > ⚠️ **Important**: This component only supports full height tiles (`tileHeight: 'FULL'`). Half-height tiles are not supported. @@ -13,14 +13,13 @@ const tile = { type: 'BADGE', tileHeight: 'FULL', configuration: { - type: 'SPECIFIC', + type: 'SPECIFIC', // or 'LATEST_EARNED' name: 'Top Spender', description: 'Spent £100 on 5 Separate transactions', artworkUrl: 'https://example.com/badge.png', count: 1, awardedDatePrefix: 'Awarded', - badgeNotEarnedMessage: 'Badge not earned yet', - emptyBadgeMessage: "You haven't earned any badges yet" + badgeNotEarnedMessage: 'Badge not earned yet' // Optional, controls earned/not earned chip visibility } } @@ -37,28 +36,40 @@ function MyComponent() { ## Configuration Object -| Property | Type | Description | -|----------|------|-------------| -| type | 'SPECIFIC' \| 'LATEST_EARNED' | Badge display type | -| name | string | Badge name | -| description | string | Badge description | -| artworkUrl | string | Badge image URL | -| count | number | Times achieved (0 = locked) | -| awardedDatePrefix | string | Text before award date | -| badgeNotEarnedMessage | string | Message for unearned badges | -| emptyBadgeMessage | string | Message when no badges earned | +| Property | Type | Required | Description | +|----------|------|----------|-------------| +| type | 'SPECIFIC' \| 'LATEST_EARNED' | Yes | Badge display type. Use 'SPECIFIC' for a particular badge, 'LATEST_EARNED' for most recent achievement | +| name | string | Yes | Badge name | +| description | string | No | Badge description | +| artworkUrl | string | Yes | Badge image URL | +| count | number | Yes | Times achieved (0 = not earned) | +| awardedDatePrefix | string | No | Text before award date | +| badgeNotEarnedMessage | string | No | Message shown in status chip when badge is not earned. If not provided, no chip will be shown for unearned badges | + +## Display Types + +### SPECIFIC +- Shows a particular badge regardless of earned state +- Always shows description if provided +- Shows earned/not earned chip if badgeNotEarnedMessage is provided + +### LATEST_EARNED +- Used to display the most recent achievement +- Hides description when not earned (count = 0) +- Shows earned/not earned chip if badgeNotEarnedMessage is provided ## States -- **Not Earned**: Shows lock icon (count: 0) +- **Not Earned**: Shows badge with count: 0 + - If `badgeNotEarnedMessage` is provided, shows status chip with that message + - For LATEST_EARNED type, hides description - **Earned Once**: Shows badge with award date - **Multiple Earned**: Shows badge with count (e.g., "3x") -- **Latest Badge**: Special display for most recent achievement ## Composition - `BadgeTile.Media` - Badge artwork container - `BadgeTile.Status` - Lock icon or achievement count -- `BadgeTile.Title` - Badge name or empty state message -- `BadgeTile.Description` - Badge description -- `BadgeTile.DateEarned` - Award date or status message \ No newline at end of file +- `BadgeTile.Title` - Badge name +- `BadgeTile.Description` - Badge description (hidden for unearned LATEST_EARNED badges) +- `BadgeTile.DateEarned` - Award date or not earned message (if provided) \ No newline at end of file