Skip to content
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

Fix/ when switching to input mode from a referenced Border token, all… #2850

Merged
merged 2 commits into from
Jun 15, 2024

Conversation

akshay-gupta7
Copy link
Contributor

Fixes #2823

  • When a user will switch to input mode from a border token which already points to a reference, the fields color, width and stroke style shall be pre-populated with the referenced values and the user will be able to choose values to override them

@akshay-gupta7 akshay-gupta7 requested a review from six7 June 12, 2024 18:46
@akshay-gupta7 akshay-gupta7 self-assigned this Jun 12, 2024
Copy link

changeset-bot bot commented Jun 12, 2024

🦋 Changeset detected

Latest commit: bcc2a28

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@tokens-studio/figma-plugin Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Comment on lines +292 to +302
const setBorderValue = React.useCallback(
(newBorderValue: SingleBorderToken['value']) => {
if (internalEditToken?.type === TokenTypes.BORDER && typeof newBorderValue === 'object') {
setInternalEditToken({
...internalEditToken,
value: { ...newBorderValue },
});
}
},
[internalEditToken],
);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the relevant part of the change in this file, I ran prettier command before committing which made lots of formatting changes

<Stack gap={2} direction="column">
{Object.entries(internalEditToken.schema.schemas.value.properties ?? {}).map(([key], keyIndex) => (
<>
<React.Fragment key={`border-input-fragment-${seed(keyIndex)}`}>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

There was a react child unique key error, hence I replaced the blank fragment with a React Fragment(with a key)

Comment on lines +68 to +73
if (mode === 'alias' && typeof internalEditToken.value === 'string') {
setBorderValue(selectedToken?.rawValue ?? {});
}
setMode(mode === 'input' ? 'alias' : 'input');
setAlias('');
}, [mode]);
}, [mode, selectedToken, internalEditToken, setBorderValue]);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The pertinent change in this file. Lots of prettier formatting in this file as well

Copy link
Collaborator

@six7 six7 left a comment

Choose a reason for hiding this comment

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

amazing ❇️

@six7 six7 merged commit a66f761 into release-139 Jun 15, 2024
7 of 8 checks passed
@six7 six7 deleted the fix-border-token-input-mode branch June 15, 2024 09:34
@six7 six7 added the 2.0-rc8 label Jun 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Overriding border token doesn’t reflect the values in the token
2 participants