Skip to content

refactor!: refactor typography.ts - limit public surface area (#422) #424

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

frano-m
Copy link
Contributor

@frano-m frano-m commented Apr 19, 2025

Closes #422.

This pull request focuses on standardizing typography usage across the codebase by replacing hardcoded typography styles and mixins with centralized constants. It also introduces consistent imports for typography properties and font definitions, improving maintainability and readability.

Typography Standardization

  • Replaced hardcoded typography variants (e.g., text-body-large-500, text-body-400-2lines) with centralized constants from TYPOGRAPHY_PROPS in components like Entity, Error, ExportMethod, and FilterNoResultsFound. [1] [2] [3] [4]

  • Updated typography mixins (e.g., textBodyLarge500, textBody4002Lines) to use FONT constants for font properties in style files such as error.styles.ts, exportForm.styles.ts, and filterMenu.styles.ts. [1] [2] [3]

Import Consolidation

  • Consolidated typography-related imports by replacing individual style imports with TYPOGRAPHY_PROPS and FONT constants in various components and styles. [1] [2] [3] [4]

ClassName Adjustments

  • Updated class names in CSS-in-JS styles to align with the new typography constants (e.g., .MuiTypography-text-body-400-2lines to .MuiTypography-body-400-2lines). [1] [2]

Removal of Deprecated Mixins

  • Removed deprecated typography mixins such as textBody4002Lines and textBodyLarge500 from various style files, replacing them with standardized FONT constants. [1] [2]

Improved Maintainability

  • Centralized typography definitions improve code maintainability by reducing duplication and ensuring consistent styling across the application.

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors typography usage by replacing hardcoded styles with centralized constants to improve consistency, maintainability, and readability across the codebase.

  • Replaces deprecated typography variants and mixins with standardized constants (TYPOGRAPHY_PROPS and FONT).
  • Consolidates typography-related imports and updates class names in CSS-in-JS styles.
  • Removes deprecated mixins to limit the public surface area of the typography module.

Reviewed Changes

Copilot reviewed 98 out of 98 changed files in this pull request and generated no comments.

Show a summary per file
File Description
variableSizeListItem.tsx Updated typography variant to use TYPOGRAPHY_PROPS.VARIANT.BODY_SMALL_400.
filters.styles.ts Replaced legacy font mixins with FONT constants for body and uppercase text.
filterRange.styles.ts Updated typography for input label using FONT constants.
filterNoResultsFound.tsx Standardized typography variants to use TYPOGRAPHY_PROPS.
filterMenu.styles.ts Updated typography in button styles to use FONT constants.
export.styles.ts Replaced legacy typography mixins with FONT constants for small body text.
manifestDownloadEntity.styles.ts Updated section title typography to use FONT constants.
terraSetUpForm.tsx/.styles.ts Standardized typography variants to use centralized constants.
formStep.tsx/.styles.ts Updated typography variants and corresponding CSS class names.
exportSummary.styles.ts Replaced legacy font mixins with FONT constants for consistency.
exportMethod.tsx/.styles.ts Updated typography to use standardized constants.
exportForm.styles.ts Standardized typography in form controls using FONT constants.
error.tsx/.styles.ts Updated error component typography to use TYPOGRAPHY_PROPS and FONT constants.
DataDictionary Tooltip & Entity files Refactored typography references to use centralized constants.
Comments suppressed due to low confidence (1)

src/components/DataDictionary/components/Tooltip/components/Title/title.tsx:3

  • [nitpick] Using the alias 'MUI_TYPOGRAPHY_PROPS' alongside another import named 'TYPOGRAPHY_PROPS' from a different module may lead to confusion. Consider renaming one of them to maintain naming consistency throughout the file.
import { TYPOGRAPHY_PROPS as MUI_TYPOGRAPHY_PROPS } from "../../../../../../styles/common/mui/typography";

@frano-m frano-m force-pushed the fran/422-typography branch from 215a4c2 to a7cb0c4 Compare April 23, 2025 23:54
@frano-m frano-m force-pushed the fran/422-typography branch from a7cb0c4 to e89fe4d Compare April 24, 2025 04:58
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.

Refactor typography.ts - limit public surface area
2 participants