Skip to content

Instantly share code, notes, and snippets.

@tealtan
Last active June 30, 2017 16:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tealtan/69c1005f0ed97f31751c6bbb01534003 to your computer and use it in GitHub Desktop.
Save tealtan/69c1005f0ed97f31751c6bbb01534003 to your computer and use it in GitHub Desktop.
Rules for Text Style Mapping

Definitions

{
  "text-styles": [
    {
      "name": "smallscreen-small-headline-hardtone",
      "typeface": "@cheltenham",
      "weight": "700",
      "font-size": "22",
      "line-height": "27",
      "letterspacing": "0.1",
      "color": "@gray-10",
      "align": "left"
    },
    {
      "name": "smallscreen-small-headline-hardtone",
      "typeface": "@cheltenham",
      "weight": "500",
      "font-size": "22",
      "line-height": "27",
      "letterspacing": "0.1",
      "color": "@gray-10",
      "align": "left"
    },
    …
  ]
}

Mapping

{
  "text-styles-mapping": [
    {
      "card-type": "standard",
      "screen-size": "small",
      "rendition": "whole",
      "tone": "hard",
      "status": "regular",
      "element": "headline",
      "text-style": "smallscreen-small-headline-hardtone"
    },
    {
      "card-type": "standard",
      "screen-size": "small",
      "rendition": "whole",
      "tone": "soft",
      "status": "regular",
      "element": "headline",
      "text-style": "smallscreen-small-headline-hardtone"
    },
    …
  ]
}
@jerrybe
Copy link

jerrybe commented Jun 30, 2017

I'm thinking of something more cascading. should be less verbose & less duplication, but may be more complicated too.
Here's the idea:

"text-styles" : [
{

  "card-type": "standard",
  "text-style": {
      "name": "smallscreen-small-headline-hardtone",
      "typeface": "@cheltenham",
      "weight": "700",
      "font-size": "22",
      "line-height": "27",
      "letterspacing": "0.1",
      "color": "@gray-10",
      "align": "left"
  },
  "screen-sizes": [
    {
        "screen-size": "small",
        "text-style": {
          "font-size": "21"
        }
    },
    {
        "screen-size": "large",
        "text-style": {
          "font-size": "30"
        }
    }
  ]
}

{
  "card-type": "bullet",
  "text-style": {
    .....
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment