Skip to content

feat: Logical properties#3265

Open
LinKCoding wants to merge 25 commits intomainfrom
kl-gmt-1451-logical-props--jh-revert
Open

feat: Logical properties#3265
LinKCoding wants to merge 25 commits intomainfrom
kl-gmt-1451-logical-props--jh-revert

Conversation

@LinKCoding
Copy link
Contributor

@LinKCoding LinKCoding commented Feb 11, 2026

Overview

Updates
Gamut:

  • Adds a new prop, useLogicalProperties which defaults to true, to GamutProvider
  • Updates tokens in variance/config.ts
  • Updates margin and padding related props to include both physical and logical CSS properties
  • Adds logical properties for border related CSS properties:
    • border*, borderWidth*, borderColor*, borderStyle*, borderRadius*,
  • Adds logical properties for width + height related CSS props
  • Adds logical properties for inset + overflow related CSS props
  • Adds direction as a token
  • Adds a new function, getPropertyMode, to transform to resolve the correct CSS property to use
  • Addresses resulting test failures due to mismatched style expectations
    • Updates MockGamutProvider to include useLogicalProps

Storybook:

  • Splits up Props into separate pages each related to their respective collection of props
    • Adds more examples for updated props
  • Adds a new toolbar tool for switching between logical and physical CSS properties
  • Adds a new toolbar tool for switching direction (LTR to RTL and vice versa)
  • Adds documentation for useLogicalProperties

PR Checklist

  • Related to designs:
  • Related to JIRA ticket: GMT-1451
  • I have run this code to verify it works
  • This PR includes unit tests for the code change
  • This PR includes testing instructions tests for the code change
  • The alpha package of this PR is passing end-to-end tests in all relevant Codecademy repositories

Related PRs:

Testing Instructions

Don't make me tap the sign.

  1. Go to Foundations/System/Props/About
  2. Check out the About page and the other new separated out pages
  3. Check over /border, /color, /layout, /positioning, and /space
  4. Verify that the examples, information, and token tables in the pages make sense
  5. Check over some components and see how they respond when the logical/physical button and/or LTR/RTL buttons are toggled
    a. some notable examples: Menu, Popover, PopoverContainer, Tab, Tip, ConnectedForm/GridForm, DataList/DataTable
  6. ...
  7. Finish and do a celebratory dance

PR Links and Envs

Repository PR Link
Monolith Monolith PR
Mono Mono PR

LinKCoding and others added 14 commits November 21, 2025 15:47
* re-orged Props.mdx files into separate pages

* updated MDN links

* update properties column with working links and styling

* updated statuses for pages that will receive new logical properties

* formatted

* fix Responsive Properities story

* applied Cass's feedback
…l vs Physical prop resolution (#3234)

* working PoC

* fix build and format

* lint fixes

* some more refactoring

* fix existing test failures

* add test for getPropertyMode

* updated gamutprovider to include useLogicalProperties

* fix failiing tests

* more test fixes

* formatted

* add logicalprops switcher to toolbar

* updated  shorthand in margin related CSS properties

* fix linting issue re: physical

* update docs to show logical prop updates to margin related props

* updated padding too

* updated Usage Guide and clean up

* add new file to explain logical and physical properties

* update docs for readibility

* formatted and cleaned up

* fix tests and edit MockGamutProvider to use useLogicalProperties

* temp fix for test failure

* removed useLogicalProperties from contextValue b.c. it's not used anymore

* added toolbar button for direction

* address Cass's feedback
* working PoC

* fix build and format

* lint fixes

* some more refactoring

* fix existing test failures

* add test for getPropertyMode

* updated gamutprovider to include useLogicalProperties

* fix failiing tests

* more test fixes

* formatted

* add logicalprops switcher to toolbar

* updated  shorthand in margin related CSS properties

* fix linting issue re: physical

* update docs to show logical prop updates to margin related props

* updated padding too

* updated Usage Guide and clean up

* add new file to explain logical and physical properties

* update docs for readibility

* formatted and cleaned up

* fix tests and edit MockGamutProvider to use useLogicalProperties

* temp fix for test failure

* start on border related logical props

* updated more border props

* formatted

* added border color props

* grammar

* formatted

* feat(Icon): ✨ Add Live Learning Icon

* chore(release): publish

 - @Codecademy/gamut@68.0.1
 - @codecademy/gamut-icons@9.55.0
 - @codecademy/gamut-kit@0.6.580

---------

Co-authored-by: Kenny Lin <kenny.lin.91@gmail.com>
Co-authored-by: Hailey <hailey.robledo@skillsoft.com>
Co-authored-by: codecademydev <dev@codecademy.com>
 - @Codecademy/gamut@68.0.1
 - @codecademy/gamut-icons@9.55.0
 - @codecademy/gamut-kit@0.6.580
 - @codecademy/styleguide@79.1.0
 - @codecademy/styleguide@79.1.1
…l vs Physical prop resolution (#3234)

* working PoC

* fix build and format

* lint fixes

* some more refactoring

* fix existing test failures

* add test for getPropertyMode

* updated gamutprovider to include useLogicalProperties

* fix failiing tests

* more test fixes

* formatted

* add logicalprops switcher to toolbar

* updated  shorthand in margin related CSS properties

* fix linting issue re: physical

* update docs to show logical prop updates to margin related props

* updated padding too

* updated Usage Guide and clean up

* add new file to explain logical and physical properties

* update docs for readibility

* formatted and cleaned up

* fix tests and edit MockGamutProvider to use useLogicalProperties

* temp fix for test failure

* removed useLogicalProperties from contextValue b.c. it's not used anymore

* added toolbar button for direction

* address Cass's feedback
@nx-cloud
Copy link

nx-cloud bot commented Feb 11, 2026

View your CI Pipeline Execution ↗ for commit f09dace


☁️ Nx Cloud last updated this comment at 2026-03-11 13:18:45 UTC

@codecov
Copy link

codecov bot commented Feb 11, 2026

⚠️ JUnit XML file not found

The CLI was unable to find any JUnit XML files to upload.
For more help, visit our troubleshooting guide.

* cleaned working state

* fix ContentContainer test

* formatted
* added logical props and provided examples

* add in story

* fix popover tests

* forcing GHA checks

* clean up some comments

* fix story height

* add example for overflow

* new story

* formatted

* fix popovercontainer alignment

* revert testing change
@LinKCoding LinKCoding marked this pull request as ready for review March 6, 2026 18:42
@LinKCoding LinKCoding requested a review from a team as a code owner March 6, 2026 18:42
Comment on lines +97 to +103
// Merge useLogicalProperties into theme so variance can access it via props.theme
const themeWithLogicalProperties = {
...theme,
useLogicalProperties,
};
const content = (
<ThemeProvider theme={theme}>
<ThemeProvider theme={themeWithLogicalProperties}>
Copy link
Contributor

Choose a reason for hiding this comment

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

i wonder if you should memoize this, ThemeProivider is kindof an expensive operation and we want to make sure it doesn't rerender for unrelated reasons

Comment on lines +479 to +526
@@ -522,7 +523,7 @@ describe('ConnectedNestedCheckboxes utils', () => {
});

it('should render an unchecked checkbox with correct props', () => {
const state = { checked: false };
const state = { checked: false, indeterminate: false };
Copy link
Contributor

Choose a reason for hiding this comment

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

i don't think you need these changes, aren't they getting indeterminate by default

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah thanks! yea, I'll revert —
fwiw, I saw these as TS errors 🤔
but after I removed the indeterminate: false they didn't come back
so maybe just some weird package state before.

Comment on lines +254 to +258
{...popoverPosition.styles}
/* Physical inline style for centered alignments (top/bottom) where
inset-inline-start would incorrectly flip the center point in RTL */
/* eslint-disable-next-line gamut/no-inline-style */
style={popoverPosition.physicalStyles}
Copy link
Contributor

Choose a reason for hiding this comment

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

i'm not the biggest fan of this approach - can 't we just swap the margin prop based on direction? this RTL change probably means we need to bump up the urgency of our ticket for PopoverContainer flipping dir when its offscreen ( i think we have something like this in the backlog)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Would you want me to revert?

I don't remember messing with margin and got hung up on the edges (top, bottom, right, left) and getting stunk this before resorting to the robot to provide an answer.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

per our discussion — will keep this, and cut a bigger ticket to address

color: ${themed('colors.navy-700')};
background-color: ${themed('colors.gray-100')};
display: inline-block;
overflow-x: scroll;
Copy link
Contributor

Choose a reason for hiding this comment

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

did we move this style somewhere else?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

tbh I don't even remember how I got here... lol
but I saw this was overriding line 36 (where overflow-x was being set to auto)

Any preference? auto vs scroll?

Copy link
Contributor

@dreamwasp dreamwasp left a comment

Choose a reason for hiding this comment

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

have a couple comments but nothing blocking 🔥

@codecademydev
Copy link
Collaborator

📬 Published Alpha Packages:

@codecademy/gamut@68.1.0-alpha.1d8645.0
@codecademy/gamut-icons@9.56.3-alpha.1d8645.0
@codecademy/gamut-illustrations@0.58.6-alpha.1d8645.0
@codecademy/gamut-kit@0.6.585-alpha.1d8645.0
@codecademy/gamut-patterns@0.10.25-alpha.1d8645.0
@codecademy/gamut-styles@17.12.0-alpha.1d8645.0
@codecademy/gamut-tests@5.3.0-alpha.1d8645.0
@codecademy/styleguide@79.2.0-alpha.1d8645.0
@codecademy/variance@0.26.0-alpha.1d8645.0

@github-actions
Copy link
Contributor

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.

7 participants