Skip to content

Extract info card style into shared file#1316

Merged
kuan121 merged 1 commit intomainfrom
extract-info-card-style-into-shared-file
Apr 21, 2026
Merged

Extract info card style into shared file#1316
kuan121 merged 1 commit intomainfrom
extract-info-card-style-into-shared-file

Conversation

@kuan121
Copy link
Copy Markdown
Contributor

@kuan121 kuan121 commented Apr 17, 2026

High Level Overview of Change

Extract the shared card styles used by the AMM Pool page (Basic Info, Market Data, Auction) and the AMM Rankings page (General Info) into a single src/containers/shared/css/info-card.scss.

Changes:

  • New shared info-card.scss with documented usage and CSS-based row dividers (replaces explicit <div className="info-card-separator" /> elements)
  • AMMPool/styles.scss and AMMRankings/ammRankings.scss import the shared styles instead of defining their own card rules
  • BasicInfoCard, MarketDataCard, AuctionCard wrapper class renamed amm-pool-info-cardinfo-card; separator <div>s removed
  • GeneralInfoCard refactored to use the shared info-card class structure (was using bespoke general-info-card / stat-row / stat-label etc.)
  • Increased gap between the General Info card and the TVL/Volume chart on the AMM Rankings page from 16px → 32px

Context of Change

The AMM Pool page and AMM Rankings page both display info cards with the same visual pattern — an icon title followed by label/value rows separated by horizontal dividers. They were implemented independently with different class names (amm-pool-info-card vs general-info-card) and different structures, leading to visual inconsistencies and duplicate CSS.

Consolidating to a single shared stylesheet:

  • Guarantees visual consistency across both pages
  • Removes ~95 lines of duplicated SCSS
  • Lets future pages adopt the same pattern with a single @use import
  • CSS-based row dividers eliminate the need for explicit separator elements in JSX (cleaner markup)

Type of Change

  • Refactor (non-breaking change that only restructures code)

Codebase Modernization

  • Updated files to React Hooks
  • Updated files to TypeScript

Before / After

Before: Two sets of info card styles — amm-pool-info-card in AMMPool/styles.scss and general-info-card in ammRankings.scss — with different spacing, structure, and class names.
Screenshot 2026-04-17 at 3 31 43 PM

After: Single shared info-card.scss used by both pages. All four cards (Basic Info, Market Data, Auction, General Info) now use identical class names (info-card, info-card-title, info-card-icon, info-card-rows, info-card-row, info-card-label, info-card-value). Visual appearance is unchanged for the AMM Pool page; the General Info card on the Rankings page now matches the AMM Pool cards exactly.
Screenshot 2026-04-17 at 3 31 32 PM

Test Plan

  1. All existing unit tests pass
  2. Lint and style check pass
  3. Manually verified visual appearance on both /amm/:id and /amm pages matches before the refactor

@kuan121 kuan121 force-pushed the extract-info-card-style-into-shared-file branch from f469326 to c800776 Compare April 17, 2026 19:34
@kuan121 kuan121 requested a review from cybele-ripple April 17, 2026 19:37
Comment thread src/containers/shared/css/info-card.scss
)}
</span>
</div>
<div className="info-card-separator" />
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I remove these lines since we no longer explicitly need a div element to create the divider line. That will be achieved using CSS.

Comment on lines -31 to +32
gap: 16px;
gap: 32px;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current gap between the TVL/Volume chart and the General Info card is too smaller, I increase it to a reasonable value.

}
}

.amm-pool-info-card {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The follow block is removed and the similar CSS is put in info-card.scss to avoid duplicate CSS

@kuan121 kuan121 force-pushed the extract-info-card-style-into-shared-file branch from c800776 to c6a15f4 Compare April 20, 2026 22:21
@kuan121 kuan121 merged commit e9a117f into main Apr 21, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants