From dd9d052623ed0041ddbcf53973a6588d26f91bed Mon Sep 17 00:00:00 2001 From: Rachel Marconi Date: Thu, 8 Aug 2024 17:51:46 -0400 Subject: [PATCH] prettierr --- src/lib/Layercake/AxisX.docs.md | 7 +- src/lib/Layercake/AxisX.stories.svelte | 30 ++-- src/lib/Layercake/AxisX.svelte | 236 +++++++++++++------------ src/lib/Layercake/AxisY.docs.md | 10 +- src/lib/Layercake/AxisY.stories.svelte | 26 ++- src/lib/Layercake/AxisY.svelte | 203 ++++++++++----------- src/lib/Layercake/data.json | 14 +- src/lib/index.js | 2 +- 8 files changed, 263 insertions(+), 265 deletions(-) diff --git a/src/lib/Layercake/AxisX.docs.md b/src/lib/Layercake/AxisX.docs.md index c3cb20e..9702abe 100644 --- a/src/lib/Layercake/AxisX.docs.md +++ b/src/lib/Layercake/AxisX.docs.md @@ -1,14 +1,14 @@ -Layercake components can be useful for out-of-the-box Svelte charts. Often, however, they are not built according to Urban style. This AxisX component takes those available in Layercake and updates them to use Urban font family, colors, and sizes. +Layercake components can be useful for out-of-the-box Svelte charts. Often, however, they are not built according to Urban style. This AxisX component takes those available in Layercake and updates them to use Urban font family, colors, and sizes. Furthermore, while Layercake components are often externally updated, this axis here is set in time at a stage where they will not break our builds. Any updates to merge in newer Layercake code will happen not project to project but here, at source, when decided necessary. Therefore, this axis will always work with expected parameters. - ## Usage Layercake axes must be built inside a Layercake component and context, and, further, within an Svg component. Both can be imported from the layercake package. The Layercake object must be passed flat array (not object) data and domain before anything can be initialized and rendered, and these are used across all components used to craft a chart. ## Want to update axis style straight from the Layercake repo? -Use this css instead: + +Use this css instead: ```js ``` - ```js import { AxisX } from "@urbaninstitute/dataviz-components"; ``` diff --git a/src/lib/Layercake/AxisX.stories.svelte b/src/lib/Layercake/AxisX.stories.svelte index d64cfbd..111e187 100644 --- a/src/lib/Layercake/AxisX.stories.svelte +++ b/src/lib/Layercake/AxisX.stories.svelte @@ -8,13 +8,13 @@ tags: ["autodocs"], argTypes: { gridlines: { - control: "boolean", + control: "boolean" }, tickMarks: { - control: "boolean", + control: "boolean" }, baseline: { - control: "boolean", + control: "boolean" }, snapTicks: { control: "boolean" @@ -23,8 +23,8 @@ control: { type: "range", min: 1, - max: 20, - }, + max: 20 + } }, xTick: { control: "number" @@ -59,24 +59,18 @@ diff --git a/src/lib/Layercake/AxisX.svelte b/src/lib/Layercake/AxisX.svelte index 99932ba..6933c84 100644 --- a/src/lib/Layercake/AxisX.svelte +++ b/src/lib/Layercake/AxisX.svelte @@ -2,119 +2,127 @@ @component Generates an SVG x-axis. This component is also configured to detect if your x-scale is an ordinal scale. If so, it will place the markers in the middle of the bandwidth. --> - - - - {#each tickVals as tick, i (tick)} - - {#if gridlines !== false} - - {/if} - {#if tickMarks === true} - - {/if} - {formatTick(tick)} - - {/each} - {#if baseline === true} - - {/if} - {#if axisLabel} - {axisLabel} - {/if} - - - \ No newline at end of file + return "middle"; + } + + + + {#each tickVals as tick, i (tick)} + + {#if gridlines !== false} + + {/if} + {#if tickMarks === true} + + {/if} + {formatTick(tick)} + + {/each} + {#if baseline === true} + + {/if} + {#if axisLabel} + {axisLabel} + {/if} + + + diff --git a/src/lib/Layercake/AxisY.docs.md b/src/lib/Layercake/AxisY.docs.md index 0db29d2..da4d3aa 100644 --- a/src/lib/Layercake/AxisY.docs.md +++ b/src/lib/Layercake/AxisY.docs.md @@ -1,21 +1,22 @@ -Layercake components can be useful for out-of-the-box Svelte charts. Often, however, they are not built according to Urban style. This AxisY component takes those available in Layercake and updates them to use Urban font family, colors, and sizes. +Layercake components can be useful for out-of-the-box Svelte charts. Often, however, they are not built according to Urban style. This AxisY component takes those available in Layercake and updates them to use Urban font family, colors, and sizes. Furthermore, while Layercake components are often externally updated, this axis here is set in time at a stage where they will not break our builds. Any updates to merge in newer Layercake code will happen not project to project but here, at source, when decided necessary. Therefore, this axis will always work with expected parameters. - ## Usage Layercake axes must be built inside a Layercake component and context, and, further, within an Svg component. Both can be imported from the layercake package. The Layercake object must be passed flat array (not object) data and domain before anything can be initialized and rendered, and these are used across all components used to craft a chart. ## Want to update axis style straight from the Layercake repo? -Use this css instead: + +Use this css instead: + ```js ``` - ```js import { AxisY } from "@urbaninstitute/dataviz-components"; ``` diff --git a/src/lib/Layercake/AxisY.stories.svelte b/src/lib/Layercake/AxisY.stories.svelte index d932c30..5513ad8 100644 --- a/src/lib/Layercake/AxisY.stories.svelte +++ b/src/lib/Layercake/AxisY.stories.svelte @@ -17,8 +17,8 @@ control: { type: "range", min: 1, - max: 10, - }, + max: 10 + } }, xTick: { control: "number", @@ -38,7 +38,7 @@ }, textAnchor: { control: "select", - options: ["start","middle","end"] + options: ["start", "middle", "end"] }, tickLabelColor: { control: { @@ -72,24 +72,18 @@ diff --git a/src/lib/Layercake/AxisY.svelte b/src/lib/Layercake/AxisY.svelte index cf7f05c..27184f9 100644 --- a/src/lib/Layercake/AxisY.svelte +++ b/src/lib/Layercake/AxisY.svelte @@ -2,106 +2,109 @@ @component Generates an SVG y-axis. This component is also configured to detect if your y-scale is an ordinal scale. If so, it will place the markers in the middle of the bandwidth. --> - - - - {#each tickVals as tick (tick)} - + + + {#each tickVals as tick (tick)} + + {#if gridlines !== false} + + {/if} + {#if tickMarks === true} + + {/if} + {formatTick(tick)} - {#if gridlines !== false} - - {/if} - {#if tickMarks === true} - - {/if} - {formatTick(tick)} - - {/each} - {#if axisLabel} - {axisLabel} - {/if} - - - \ No newline at end of file + + {/each} + {#if axisLabel} + {axisLabel} + {/if} + + + diff --git a/src/lib/Layercake/data.json b/src/lib/Layercake/data.json index 55e6a46..c3c512b 100644 --- a/src/lib/Layercake/data.json +++ b/src/lib/Layercake/data.json @@ -1,8 +1,8 @@ [ -["year","value"], -[1979, 2], -[1980, 3], -[1981, 5], -[1982, 8], -[1983, 18] -] \ No newline at end of file + ["year", "value"], + [1979, 2], + [1980, 3], + [1981, 5], + [1982, 8], + [1983, 18] +] diff --git a/src/lib/index.js b/src/lib/index.js index f35f7b1..143b38f 100644 --- a/src/lib/index.js +++ b/src/lib/index.js @@ -28,4 +28,4 @@ export { default as PymChild } from "./Pym/PymChild.svelte"; export { default as LoadingWrapper } from "./LoadingWrapper/LoadingWrapper.svelte"; export { default as Tooltip } from "./Tooltip/Tooltip.svelte"; export { default as AxisY } from "./Layercake/AxisY.svelte"; -export { default as AxisX } from "./Layercake/AxisX.svelte"; \ No newline at end of file +export { default as AxisX } from "./Layercake/AxisX.svelte";