Skip to content

refactor(many): remove checkerboard background in examples, fix TS type errors, use types from react-docgen#1915

Merged
matyasf merged 1 commit intomasterfrom
docs_fix_build_and_remove_checkerboard
Apr 24, 2025
Merged

refactor(many): remove checkerboard background in examples, fix TS type errors, use types from react-docgen#1915
matyasf merged 1 commit intomasterfrom
docs_fix_build_and_remove_checkerboard

Conversation

@matyasf
Copy link
Collaborator

@matyasf matyasf commented Mar 24, 2025

The checkedboard needed to go because dark squared did not meet WCAG 2.1 AA contrast requirements against red error text.
Also type checking of docs during bootstrap and use types from react-docgen

To test:

  • check pages in the docs app that they look OK and there are no console errors
  • check code examples that the checkerboard is gone and things look OK

Fixes INSTUI-4282

Comment on lines -95 to -96
// TODO these are from React-docgen Documentation.d.ts,
// remove when react-docgen exports them
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

react-docgen exports these types now, so it can be deleted from here

Comment on lines +276 to +279
{
"path": "../ui-color-picker/tsconfig.build.json"
},
Copy link
Collaborator Author

@matyasf matyasf Mar 24, 2025

Choose a reason for hiding this comment

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

This will type check the docs app during build, it just increases build time by ~1 sec. This surfaced a couple of type errors in our docs app, I've fixed those.

@matyasf matyasf force-pushed the docs_fix_build_and_remove_checkerboard branch from 850e32c to 3bb8025 Compare March 24, 2025 11:33
@matyasf matyasf self-assigned this Mar 24, 2025
@github-actions
Copy link

github-actions bot commented Mar 24, 2025

PR Preview Action v1.6.1
Preview removed because the pull request was closed.
2025-04-24 11:49 UTC

@balzss balzss force-pushed the chore/get-rid-of-jsx-pragma branch from a8424d2 to 341910f Compare March 24, 2025 17:01
@balzss balzss force-pushed the chore/get-rid-of-jsx-pragma branch 8 times, most recently from b44b926 to e958919 Compare April 16, 2025 12:18
Base automatically changed from chore/get-rid-of-jsx-pragma to master April 22, 2025 09:34
@matyasf matyasf force-pushed the docs_fix_build_and_remove_checkerboard branch 3 times, most recently from c0a2768 to 7fcf550 Compare April 22, 2025 15:05
@matyasf matyasf requested a review from Copilot April 22, 2025 15:14
Copy link

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 removes the checkerboard background from examples for better WCAG 2.1 AA contrast compliance, fixes TypeScript type errors, and updates theme types to use definitions from react-docgen. Key changes include:

  • Eliminating all checkerboard-related styles and props from the Preview and Playground components.
  • Refining TypeScript typings across multiple components (Preview, Document, App, etc.) using updated types from react-docgen and ui-themes.
  • Minor refactors in Nav, Header, ColorTable, and build scripts to align with the new theming and type structures.

Reviewed Changes

Copilot reviewed 31 out of 32 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/docs/src/Preview/theme.ts Removed checkerboard color constants and related properties; updated background color and border color values.
packages/docs/src/Preview/styles.ts Simplified style generation by removing checkerboard variants and using the new backgroundColor property.
packages/docs/src/Preview/props.ts Removed background prop definitions and allowedProps entries.
packages/docs/src/Preview/index.tsx Removed default background prop from component defaults.
packages/docs/src/Playground/props.ts Removed background prop definitions and updated allowedProps accordingly.
packages/docs/src/Playground/index.tsx Removed background prop usage when rendering Preview and updated default props.
packages/docs/src/NavToggle/props.ts Simplified type definitions by removing redundant imports and using Omit.
packages/docs/src/Nav/props.ts Enhanced NavProps with OtherHTMLAttributes for improved prop support.
packages/docs/src/Nav/index.tsx Updated the event type in removeFocus and streamlined Children.count usage.
packages/docs/src/Header/index.tsx Removed an unnecessary span wrapper around header name and version.
packages/docs/src/Figure/props.ts Updated theme values to fetch colors from the new Colors.contrasts interface.
packages/docs/src/Document/props.ts Revised themeVariables and componentTheme types to align with the new Theme definitions.
packages/docs/src/Document/index.tsx Renamed and refactored generateComponentTheme to generateTheme and updated state assignment logic.
packages/docs/src/ColorTable/props.ts & index.tsx Improved type definitions for color mappings.
packages/docs/src/App/props.ts Added new ThemeFunctions types and updated DocData typings for proper theme generation.
packages/docs/src/App/index.tsx Cleaned up import statements from emotion.
packages/docs/functionalComponentThemes.ts Updated the import and type usage for theme functions (note the key renaming from lowercase to “Avatar”).
packages/docs/buildScripts/DataTypes.mts Removed deprecated react-docgen type definitions and updated themes resource type.
Files not reviewed (1)
  • packages/docs/package.json: Language not supported

const generateTheme = doc?.componentInstance?.generateComponentTheme
const generateThemeFunctional =
functionalComponentThemes[
doc.id as keyof typeof functionalComponentThemes
Copy link

Copilot AI Apr 22, 2025

Choose a reason for hiding this comment

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

Ensure that the key used to access functionalComponentThemes matches the expected case. Previously, doc.id was converted to lowercase before lookup—if the functionalComponentThemes keys are stored in lowercase, consider using doc.id.toLowerCase() to avoid potential mismatches.

Suggested change
doc.id as keyof typeof functionalComponentThemes
doc.id.toLowerCase() as keyof typeof functionalComponentThemes

Copilot uses AI. Check for mistakes.
@matyasf matyasf changed the title WIP refactor(many): remove checkerboard background in examples, fix TS type errors, use types from react-docgen refactor(many): remove checkerboard background in examples, fix TS type errors, use types from react-docgen Apr 22, 2025
…pe errors, use types from react-docgen

The checkedboard needed to go because dark squared did not meet WCAG 2.1 AA contrast requirements
against red error text.
Also type checking of docs during bootstrap and use types from react-docgen

Fixes INSTUI-4282
@matyasf matyasf force-pushed the docs_fix_build_and_remove_checkerboard branch from 7fcf550 to 49d626f Compare April 23, 2025 14:08
@matyasf matyasf merged commit 62ab0f8 into master Apr 24, 2025
11 checks passed
@matyasf matyasf deleted the docs_fix_build_and_remove_checkerboard branch April 24, 2025 11:48
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.

4 participants