From 44c0bfba614773d51d5c4960b667e318458312d2 Mon Sep 17 00:00:00 2001 From: mitchthorson Date: Wed, 6 Dec 2023 18:30:48 -0500 Subject: [PATCH] Update prettierrc, format code --- .prettierrc | 2 +- CHANGELOG.md | 1 + src/lib/BasicDropdown/BasicDropdown.svelte | 14 +- src/lib/Scorecard/Scorecard.svelte | 156 ++++----- src/lib/utils/colors.js | 366 ++++++++++----------- src/lib/utils/index.js | 2 +- 6 files changed, 271 insertions(+), 270 deletions(-) diff --git a/.prettierrc b/.prettierrc index 2d38c79a..f62d924f 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,5 +1,5 @@ { - "useTabs": true, + "tabWidth": 2, "singleQuote": false, "trailingComma": "none", "printWidth": 100, diff --git a/CHANGELOG.md b/CHANGELOG.md index e25a575d..fea346bc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## 0.1.0 +- Update .prettierrc - Add color utility module - Add Storybook instance for documentation and testing - Simplify global styles, move to lib folder diff --git a/src/lib/BasicDropdown/BasicDropdown.svelte b/src/lib/BasicDropdown/BasicDropdown.svelte index b445334f..3c1472f7 100644 --- a/src/lib/BasicDropdown/BasicDropdown.svelte +++ b/src/lib/BasicDropdown/BasicDropdown.svelte @@ -1,15 +1,15 @@
- - {#if value} -
-
- {value} -
-
- {/if} - - {#if label} -
-
- {label} -
-
- {/if} + + {#if value} +
+
+ {value} +
+
+ {/if} + + {#if label} +
+
+ {label} +
+
+ {/if}
diff --git a/src/lib/utils/colors.js b/src/lib/utils/colors.js index 69e2cb43..097ba9fa 100644 --- a/src/lib/utils/colors.js +++ b/src/lib/utils/colors.js @@ -3,64 +3,64 @@ * @type Record */ const colors = { - black: "#000000", - white: "#FFFFFF", - blue_shade_darkest: "#062635", - blue_shade_darker: "#0A4C6A", - blue_shade_dark: "#12719E", - blue: "#1696D2", - blue_shade_medium: "#46ABDB", - blue_shade_light: "#73BFE2", - blue_shade_lighter: "#A2D4EC", - blue_shade_lightest: "#CFE8F3", - gray_shade_darkest: "#353535", - gray_shade_darker: "#696969", - gray_shade_dark: "#9D9D9D", - gray: "#D2D2D2", - gray_shade_medium: "#DCDBDB", - gray_shade_light: "#E3E3E3", - gray_shade_lighter: "#ECECEC", - gray_shade_lightest: "#F5F5F5", - yellow_shade_darkest: "#843215", - yellow_shade_darker: "#CA5800", - yellow_shade_dark: "#E88E2D", - yellow: "#FDBF11", - yellow_shade_medium: "#FCCB41", - yellow_shade_light: "#FDD870", - yellow_shade_lighter: "#FCE39E", - yellow_shade_lightest: "#FFF2CF", - magenta_shade_darkest: "#351123", - magenta_shade_darker: "#761548", - magenta_shade_dark: "#af1f6b", - magenta: "#EC00BB", - magenta_shade_medium: "#E54096", - magenta_shade_light: "#E46AA7", - magenta_shade_lighter: "#EB99C2", - magenta_shade_lightest: "#F5CBDF", - green_shade_darkest: "#1A2E19", - green_shade_darker: "#2C5C2D", - green_shade_dark: "#408941", - green: "#55B748", - green_shade_medium: "#78C26D", - green_shade_light: "#98CF90", - green_shade_lighter: "#BCDEB4", - green_shade_lightest: "#DCEDD9", - red_shade_darkest: "#1A2E19", - red_shade_darker: "#6E1614", - red_shade_dark: "#A4201D", - red: "#DB2B27", - red_shade_medium: "#E25552", - red_shade_light: "#E9807D", - red_shade_lighter: "#F1AAA9", - red_shade_lightest: "#F8D5D4", - space_gray_shade_darkest: "#0E0C0D", - space_gray_shade_darker: "#1A1717", - space_gray_shade_dark: "#262223", - space_gray_shade_medium_dark: "#332D2F", - space_gray: "#5C5859", - space_gray_shade_light: "#848081", - space_gray_shade_lighter: "#ADABAC", - space_gray_shade_lightest: "#D5D5D4" + black: "#000000", + white: "#FFFFFF", + blue_shade_darkest: "#062635", + blue_shade_darker: "#0A4C6A", + blue_shade_dark: "#12719E", + blue: "#1696D2", + blue_shade_medium: "#46ABDB", + blue_shade_light: "#73BFE2", + blue_shade_lighter: "#A2D4EC", + blue_shade_lightest: "#CFE8F3", + gray_shade_darkest: "#353535", + gray_shade_darker: "#696969", + gray_shade_dark: "#9D9D9D", + gray: "#D2D2D2", + gray_shade_medium: "#DCDBDB", + gray_shade_light: "#E3E3E3", + gray_shade_lighter: "#ECECEC", + gray_shade_lightest: "#F5F5F5", + yellow_shade_darkest: "#843215", + yellow_shade_darker: "#CA5800", + yellow_shade_dark: "#E88E2D", + yellow: "#FDBF11", + yellow_shade_medium: "#FCCB41", + yellow_shade_light: "#FDD870", + yellow_shade_lighter: "#FCE39E", + yellow_shade_lightest: "#FFF2CF", + magenta_shade_darkest: "#351123", + magenta_shade_darker: "#761548", + magenta_shade_dark: "#af1f6b", + magenta: "#EC00BB", + magenta_shade_medium: "#E54096", + magenta_shade_light: "#E46AA7", + magenta_shade_lighter: "#EB99C2", + magenta_shade_lightest: "#F5CBDF", + green_shade_darkest: "#1A2E19", + green_shade_darker: "#2C5C2D", + green_shade_dark: "#408941", + green: "#55B748", + green_shade_medium: "#78C26D", + green_shade_light: "#98CF90", + green_shade_lighter: "#BCDEB4", + green_shade_lightest: "#DCEDD9", + red_shade_darkest: "#1A2E19", + red_shade_darker: "#6E1614", + red_shade_dark: "#A4201D", + red: "#DB2B27", + red_shade_medium: "#E25552", + red_shade_light: "#E9807D", + red_shade_lighter: "#F1AAA9", + red_shade_lightest: "#F8D5D4", + space_gray_shade_darkest: "#0E0C0D", + space_gray_shade_darker: "#1A1717", + space_gray_shade_dark: "#262223", + space_gray_shade_medium_dark: "#332D2F", + space_gray: "#5C5859", + space_gray_shade_light: "#848081", + space_gray_shade_lighter: "#ADABAC", + space_gray_shade_lightest: "#D5D5D4" }; /** @@ -68,17 +68,17 @@ const colors = { * @returns {string[]} - An array of colors */ function getBlues() { - const shades = [ - colors.blue_shade_lightest, - colors.blue_shade_lighter, - colors.blue_shade_light, - colors.blue_shade_medium, - colors.blue, - colors.blue_shade_dark, - colors.blue_shade_darker, - colors.blue_shade_darkest - ]; - return shades.slice(); + const shades = [ + colors.blue_shade_lightest, + colors.blue_shade_lighter, + colors.blue_shade_light, + colors.blue_shade_medium, + colors.blue, + colors.blue_shade_dark, + colors.blue_shade_darker, + colors.blue_shade_darkest + ]; + return shades.slice(); } /** @@ -86,17 +86,17 @@ function getBlues() { * @returns {string[]} - An array of colors */ function getMagentas() { - const shades = [ - colors.magenta_shade_lightest, - colors.magenta_shade_lighter, - colors.magenta_shade_light, - colors.magenta_shade_medium, - colors.magenta, - colors.magenta_shade_dark, - colors.magenta_shade_darker, - colors.magenta_shade_darkest - ]; - return shades.slice(); + const shades = [ + colors.magenta_shade_lightest, + colors.magenta_shade_lighter, + colors.magenta_shade_light, + colors.magenta_shade_medium, + colors.magenta, + colors.magenta_shade_dark, + colors.magenta_shade_darker, + colors.magenta_shade_darkest + ]; + return shades.slice(); } /** @@ -104,17 +104,17 @@ function getMagentas() { * @returns {string[]} - An array of colors */ function getGrays() { - const shades = [ - colors.gray_shade_lightest, - colors.gray_shade_lighter, - colors.gray_shade_light, - colors.gray_shade_medium, - colors.gray, - colors.gray_shade_dark, - colors.gray_shade_darker, - colors.gray_shade_darkest - ]; - return shades.slice(); + const shades = [ + colors.gray_shade_lightest, + colors.gray_shade_lighter, + colors.gray_shade_light, + colors.gray_shade_medium, + colors.gray, + colors.gray_shade_dark, + colors.gray_shade_darker, + colors.gray_shade_darkest + ]; + return shades.slice(); } /** @@ -122,17 +122,17 @@ function getGrays() { * @returns {string[]} - An array of colors */ function getYellows() { - const shades = [ - colors.yellow_shade_lightest, - colors.yellow_shade_lighter, - colors.yellow_shade_light, - colors.yellow_shade_medium, - colors.yellow, - colors.yellow_shade_dark, - colors.yellow_shade_darker, - colors.yellow_shade_darkest - ]; - return shades.slice(); + const shades = [ + colors.yellow_shade_lightest, + colors.yellow_shade_lighter, + colors.yellow_shade_light, + colors.yellow_shade_medium, + colors.yellow, + colors.yellow_shade_dark, + colors.yellow_shade_darker, + colors.yellow_shade_darkest + ]; + return shades.slice(); } /** @@ -140,17 +140,17 @@ function getYellows() { * @returns {string[]} - An array of colors */ function getGreens() { - const shades = [ - colors.green_shade_lightest, - colors.green_shade_lighter, - colors.green_shade_light, - colors.green_shade_medium, - colors.green, - colors.green_shade_dark, - colors.green_shade_darker, - colors.green_shade_darkest - ]; - return shades.slice(); + const shades = [ + colors.green_shade_lightest, + colors.green_shade_lighter, + colors.green_shade_light, + colors.green_shade_medium, + colors.green, + colors.green_shade_dark, + colors.green_shade_darker, + colors.green_shade_darkest + ]; + return shades.slice(); } /** @@ -158,17 +158,17 @@ function getGreens() { * @returns {string[]} - An array of colors */ function getSpaceGrays() { - const shades = [ - colors.space_gray_shade_lightest, - colors.space_gray_shade_lighter, - colors.space_gray_shade_light, - colors.space_gray, - colors.space_gray_shade_medium_dark, - colors.space_gray_shade_dark, - colors.space_gray_shade_darker, - colors.space_gray_shade_darkest - ]; - return shades.slice(); + const shades = [ + colors.space_gray_shade_lightest, + colors.space_gray_shade_lighter, + colors.space_gray_shade_light, + colors.space_gray, + colors.space_gray_shade_medium_dark, + colors.space_gray_shade_dark, + colors.space_gray_shade_darker, + colors.space_gray_shade_darkest + ]; + return shades.slice(); } /** @@ -176,17 +176,17 @@ function getSpaceGrays() { * @returns {string[]} - An array of colors */ function getReds() { - const shades = [ - colors.red_shade_lightest, - colors.red_shade_lighter, - colors.red_shade_light, - colors.red_shade_medium, - colors.red, - colors.red_shade_dark, - colors.red_shade_darker, - colors.red_shade_darkest - ]; - return shades.slice(0, numColors); + const shades = [ + colors.red_shade_lightest, + colors.red_shade_lighter, + colors.red_shade_light, + colors.red_shade_medium, + colors.red, + colors.red_shade_dark, + colors.red_shade_darker, + colors.red_shade_darkest + ]; + return shades.slice(0, numColors); } /** @@ -194,16 +194,16 @@ function getReds() { * @returns {string[]} - An array of colors */ function getDivergingColors() { - return [ - colors.yellow_shade_darker, - colors.yellow, - colors.yellow_shade_light, - colors.yellow_shade_lightest, - colors.blue_shade_lightest, - colors.blue_shade_light, - colors.blue, - colors.blue_shade_darker - ]; + return [ + colors.yellow_shade_darker, + colors.yellow, + colors.yellow_shade_light, + colors.yellow_shade_lightest, + colors.blue_shade_lightest, + colors.blue_shade_light, + colors.blue, + colors.blue_shade_darker + ]; } /** @@ -211,37 +211,37 @@ function getDivergingColors() { * @param {number} [numColors=6] - The number of colors to return - must be 6 or less * @returns {string[]} - An array of colors */ -function getCategoricalColors(numColors = 6){ - if (numColors > 6) { - console.warn( - "If you need more than 6 colors, you'll need to construct your own palette by using the colors object exported from this module." - ); - throw new Error("getCategoricalColors only supports up to 6 colors."); - } +function getCategoricalColors(numColors = 6) { + if (numColors > 6) { + console.warn( + "If you need more than 6 colors, you'll need to construct your own palette by using the colors object exported from this module." + ); + throw new Error("getCategoricalColors only supports up to 6 colors."); + } if (numColors < 2) { throw new Error("getCategoricalColors must have at least 2 colors."); } - if (numColors === 2) { - return [colors.blue, colors.yellow]; - } - if (numColors === 3) { - return [colors.blue, colors.yellow, colors.magenta]; - } - if (numColors === 4) { - return [colors.blue, colors.yellow, colors.magenta, colors.green]; - } - if (numColors === 5) { - return [colors.blue, colors.yellow, colors.magenta, colors.green, colors.blue_shade_darker]; - } - return [ - colors.blue, - colors.yellow, - colors.magenta, - colors.green, - colors.blue_shade_darker, - colors.space_gray - ]; + if (numColors === 2) { + return [colors.blue, colors.yellow]; + } + if (numColors === 3) { + return [colors.blue, colors.yellow, colors.magenta]; + } + if (numColors === 4) { + return [colors.blue, colors.yellow, colors.magenta, colors.green]; + } + if (numColors === 5) { + return [colors.blue, colors.yellow, colors.magenta, colors.green, colors.blue_shade_darker]; + } + return [ + colors.blue, + colors.yellow, + colors.magenta, + colors.green, + colors.blue_shade_darker, + colors.space_gray + ]; } /** @@ -259,16 +259,16 @@ function getMapBlues() { } export default { - ...colors, - getBlues, - getMagentas, - getGrays, - getGreens, - getYellows, - getGrays, - getSpaceGrays, - getReds, - getCategoricalColors, - getDivergingColors, + ...colors, + getBlues, + getMagentas, + getGrays, + getGreens, + getYellows, + getGrays, + getSpaceGrays, + getReds, + getCategoricalColors, + getDivergingColors, getMapBlues }; diff --git a/src/lib/utils/index.js b/src/lib/utils/index.js index 7bca32b2..65e4496e 100644 --- a/src/lib/utils/index.js +++ b/src/lib/utils/index.js @@ -1 +1 @@ -export {default as urbanColors} from "./colors.js"; +export { default as urbanColors } from "./colors.js";