question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

small fontSize rename, and 0-indexing arrays?

See original GitHub issue

Example from Readme, regarding theme:

export default {
  ...
  space: [0, 4, 8, 16, 32, 64, 128, 256, 512],
  fontSizes: [16, 20, 24, 32],
  text: {
    h1: {
      fontSize: 3, // this is 24px, taken from `fontSize` above
    },
    p: {
      fontSize: 1, // & this is 16px, taken from `fontSize` above
    },
  },
}

Might be an idea to rename some fields to:

export default {
   ...
  space: [0, 4, 8, 16, 32, 64, 128, 256, 512], // in pixels, not em
  fontSizes: [16, 20, 24, 32], // in pixels, not em
  text: {
    h1: {
      fontSizeIndex: 2, // self-explaining, so no doc needed
    },
    p: {
      fontSizeIndex: 0,
    },
  },
}

So that you can’t confuse the index with a size, and to 0-index it since people are familiar with that when dealing with arrays. The following example in the Readme seems to be using 0-indexing, so either case might just be a Readme remnant.

<Text
  sx={{
    color: 'primary',
    padding: [1, 3], // [4px, 16px] from theme!
  }}
>
  Themed color!
</Text>

Alternatively also rename: paddingpaddingIndex.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
nandorojocommented, Jun 10, 2021

0-index is correct. There’s no magic, it just checks theme[key][value]

1reaction
nandorojocommented, Jun 4, 2021

Oh yeah the readme is probably picking the wrong index, we can fix that

Read more comments on GitHub >

github_iconTop Results From Across the Web

Arrays - Learn Ada (by AdaCore)
Array type declaration . Arrays in Ada are used to define contiguous collections of elements that can be selected by indexing. Here's...
Read more >
Built-in Macro Functions - ImageJ
Returns the Unicode value of the character at the specified index in string. Index values can range from 0 to lengthOf(string). Use the ......
Read more >
Array Indexing: 0-based or 1-based? | by Kim Fung - Medium
Zero-based array indexing is a way of numbering the items in an array such that the first item of it has an index...
Read more >
Indexing and Selecting Data — pandas 0.15.2 documentation
A boolean array. See more at Selection by Label .iloc is primarily integer position based (from 0 to length-1 ...
Read more >
ARRAY | CockroachDB Docs
The ARRAY data type stores one-dimensional, 1-indexed, homogeneous arrays of any non-array data types.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found