Skip to content

LevelThermometer uses hard coded max level value #41

@mrfmunger

Description

@mrfmunger

The LevelThermometer component uses a hard coded value to determine the scale of the overall thermometer. If you change the pointsToLevels and maxLevel values in the constants file, the LevelThermometer will render incorrectly (since it's still referencing the hard coded value).

Locations where maxLevel is hard coded instead of referenced.
https://github.com/Medium/snowflake/blob/master/components/LevelThermometer.js#L32
https://github.com/Medium/snowflake/blob/master/components/PointSummaries.js#L25

Example

Updating the following values in constants.js results in a poorly formatted thermometer.

export const pointsToLevels = {
  "0": "1",
  "20": "2",
  "24": "3",
  "29": "4",
  "34": "5",
  "38": "6",
  "43": "7",
  "47": "8",
  "49": "9",
  "51": "10"
};

export const maxLevel = 52;

screen shot 2018-07-09 at 12 10 12 pm

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions