figmagic icon indicating copy to clipboard operation
figmagic copied to clipboard

Not ignoring nested frames with prefixes

Open davidbwaters opened this issue 2 years ago • 10 comments

Describe the bug Hi, since you added support for frame variants, it's not ignoring prefixed frames with the '_' or ':' prefixes

Expected behavior These shouldn't be added to the output.

davidbwaters avatar Aug 04 '22 23:08 davidbwaters

I am not able to reproduce this. Are you using Figmagic 4.5.0? Even the mixed-use messy example here works as intended. Screenshot 2022-08-05 at 06 58 03

CSS code with a bit of omissions:

const ButtonWithFramesCss = `
  <...>

  &.NormalGroup {
    padding-left: ${spacing['small']};
    padding-right: ${spacing['small']};
    background-color: ${colors['blue1']};
    &:disabled {
      background-color: ${colors['gray1']};
    }
  }

  &.Normal {
    padding-left: ${spacing['small']};
    padding-right: ${spacing['small']};
    background-color: ${colors['blue1']};
    &:disabled {
      background-color: ${colors['gray1']};
    }
  }

  &.Warning {
    padding-left: ${spacing['small']};
    padding-right: ${spacing['small']};
    background-color: ${colors['orange']};
    &:disabled {
      background-color: ${colors['gray1']};
    }
    &:hover {
      background-color: ${colors['yellow']};
    }
  }

  &.Error {
    padding-left: ${spacing['small']};
    padding-right: ${spacing['small']};
    background-color: ${colors['red']};
    &:hover {
      background-color: rgba(123, 34, 34, 1);
    }
  }

`;

export default ButtonWithFramesCss;

mikaelvesavuori avatar Aug 05 '22 04:08 mikaelvesavuori

Note that : is not an exclusion pattern, but a way to express text being text (i.e. root of element) and then, when used for frames/groups, for subclassing.

mikaelvesavuori avatar Aug 05 '22 04:08 mikaelvesavuori

Sorry I updated the file with a workaround. I'll post a fork with it how it was, but basically it's the button component's hidden icon with text layer. When it's prefixed with an underscore, it still gets output with the underscore in the class name.

davidbwaters avatar Aug 05 '22 11:08 davidbwaters

I have indeed seen that (root) elements prefixed with an underscore were not ignored. I will push that fix later in 4.5.1.

EDIT: Out now, see https://github.com/mikaelvesavuori/figmagic/releases/tag/v4.5.1

mikaelvesavuori avatar Aug 05 '22 12:08 mikaelvesavuori

Awesome, thanks!

davidbwaters avatar Aug 05 '22 13:08 davidbwaters

Let's close this one as there is nothing more to add here?

mikaelvesavuori avatar Aug 05 '22 13:08 mikaelvesavuori

Hey, I'm still having the issue after the update. This is the file you can test with. It's the button element's _with-icon child. https://www.figma.com/file/cTi2jRPF169TxakM3pX6Dt/MTX-Figmagic-(Copy)?node-id=3914%3A9510

davidbwaters avatar Aug 05 '22 22:08 davidbwaters

I don't have permission to access the file.

mikaelvesavuori avatar Aug 06 '22 05:08 mikaelvesavuori

I am just toying a bit with what I already have and I am pretty sure I see the issue. Figmagic is hard-wired to support only limited nesting, so not only will not underscore exclusions not work, nothing else will either if it's not found in either the root OR in the first-level frames/groups.

When I have access I'll try to verify your new file with my statement.

mikaelvesavuori avatar Aug 06 '22 05:08 mikaelvesavuori

sorry, I updated the sharing settings

davidbwaters avatar Aug 08 '22 02:08 davidbwaters

Hey again. Sorry for being late to this. Looking at the file, this is still a structural error in your file rather than with Figmagic itself. The "root" Button should not contain the variants, you will need to drag these into individual, independent frames/groups.

mikaelvesavuori avatar Aug 13 '22 10:08 mikaelvesavuori

I am ready to close this, if you are OK with it @davidbwaters and have verified that Figmagic is ignoring as per the expected pattern I have written about?

mikaelvesavuori avatar Aug 20 '22 08:08 mikaelvesavuori

Closing because of lack of activity

mikaelvesavuori avatar Sep 08 '22 15:09 mikaelvesavuori