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

Typography types consistency (expanded typography token types are singular whereas 'standalone' typography tokens are plural) #1417

Closed
thomasmattheussen opened this issue Nov 7, 2022 · 0 comments · Fixed by #1423

Comments

@thomasmattheussen
Copy link
Contributor

thomasmattheussen commented Nov 7, 2022

Describe the bug
There seems to be a bug in the type field of some tokens after using token-transformer with --expandTypography=true. Expanded typography tokens have types that are in singular form (fontSize, fontWeight, ...) whereas regular typo tokens have types in plural form (fontSizes, fontWeights, ...) as they are exported from the figma plugin.

EDIT: I found out that this happens due to the value keys of the typography token being used as the type for the expanded tokens. (if that makes sens 😅 )

To Reproduce
Steps to reproduce the behavior:

Transform this input JSON (exported from Figma Tokens)

{
  "example": {
    "typography": {
      "value": {
        "fontFamily": "Open Sans",
        "fontSize": "16"
      },
      "type": "typography"
    },
    "soloFontSize": {
      "xs": {
        "value": "16",
        "type": "fontSizes"
      }
    },
    "soloFontFamily": {
      "system": {
        "value": "Open Sans",
        "type": "fontFamilies"
      }
    }
  }
}

with the command

$ npx token-transformer input.json output.json example --expandTypography

The result is (notice the difference in the type fields):

{
  "typography": {
    "fontFamily": {
      "value": "Open Sans",
      "type": "fontFamily"
    },
    "fontSize": {
      "value": 16,
      "type": "fontSize"
    }
  },
  "soloFontSize": {
    "xs": {
      "value": 16,
      "type": "fontSizes"
    }
  },
  "soloFontFamily": {
    "system": {
      "value": "Open Sans",
      "type": "fontFamilies"
    }
  }
}

Expected behavior
I'd expect the types to be exactly the same instead of the expanded ones being singular and the others being in the plural form. Preferably they'd all be in the singular form for consistency with other types. So, like this:

{
  "typography": {
    "fontFamily": {
      "value": "Open Sans",
      "type": "fontFamily"
    },
    "fontSize": {
      "value": 16,
      "type": "fontSize"
    }
  },
  "soloFontSize": {
    "xs": {
      "value": 16,
      "type": "fontSize"
    }
  },
  "soloFontFamily": {
    "system": {
      "value": "Open Sans",
      "type": "fontFamily"
    }
  }
}
@six7 six7 mentioned this issue Dec 5, 2022
@six7 six7 moved this to 📥 Triage in Tokens Studio for Figma Roadmap Dec 10, 2022
@six7 six7 moved this from 📥 Triage to 🤞 To be released in Tokens Studio for Figma Roadmap Dec 10, 2022
@six7 six7 closed this as completed in b0e4e69 Dec 30, 2022
@github-project-automation github-project-automation bot moved this from 🤞 To be released to 🕜 In Progress in Tokens Studio for Figma Roadmap Dec 30, 2022
@six7 six7 moved this from 🕜 In Progress to ✅ Done in Tokens Studio for Figma Roadmap Jan 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ✅ Done
Development

Successfully merging a pull request may close this issue.

1 participant