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/ min&max width&height on instances #2842

Merged
merged 4 commits into from
Jun 15, 2024
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { NodeTokenRefMap } from '@/types/NodeTokenRefMap';
import { isPrimitiveValue } from '@/utils/is';
import { tryApplyVariableId } from '@/utils/tryApplyVariableId';
import { transformValue } from './helpers';
import { isPartOfInstance } from '@/utils/is/isPartOfInstance';
import { isAutoLayout } from '@/utils/isAutoLayout';

export async function applySizingValuesOnNode(
Expand Down Expand Up @@ -54,8 +53,6 @@ export async function applySizingValuesOnNode(
if (
node.type !== 'DOCUMENT'
&& node.type !== 'PAGE'
&& node.type !== 'INSTANCE'
&& !isPartOfInstance(node.id)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this part here needs to stay in - we cant apply min max width tokens on instance children, this would throw an error

CleanShot 2024-06-12 at 10 07 18@2x

Copy link
Collaborator

Choose a reason for hiding this comment

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

as in just the isPartofInstance needs to stay in

Copy link
Contributor

Choose a reason for hiding this comment

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

If this stays, then this is not the fully fledged fix? Can't see any other changes 😅

Copy link
Collaborator

Choose a reason for hiding this comment

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

It basically just resolves the case descrbied in the issue: if the layer itself is an instance, we want to allow setting sizing related tokens (as this is possibly). However, if its part of an instance this wouldnt work because figma doesnt allow it.

&& (isAutoLayout(node)
|| (node.parent && node.parent.type !== 'DOCUMENT' && node.parent.type !== 'PAGE' && isAutoLayout(node.parent)))
) {
Expand Down
Loading