-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #53 from mattlangeman/bars-bar-component-refactoring
Bars bar component refactoring
- Loading branch information
Showing
12 changed files
with
369 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<script lang="ts"> | ||
import { getContext } from 'svelte'; | ||
import type { spring as springStore, tweened as tweenedStore } from 'svelte/motion'; | ||
import { createDimensionGetter } from '$lib/utils/rect'; | ||
import Rect from './Rect.svelte'; | ||
const {x: xContext, y: yContext, rGet, config } = getContext('LayerCake'); | ||
export let bar: Object; | ||
/** | ||
* Override `x` from context. Useful for multiple Bar instances | ||
*/ | ||
export let x = $xContext; | ||
/** | ||
* Override `y` from context. Useful for multiple Bar instances | ||
*/ | ||
export let y = $yContext; | ||
export let fill: string | undefined = undefined; | ||
export let stroke = 'black'; | ||
export let strokeWidth = 0; | ||
export let radius = 0; | ||
export let getProps: ((obj: { value: any; item: any; index: number }) => any) | undefined = | ||
undefined; | ||
export let padding = 0; | ||
export let groupBy: string | undefined = undefined; | ||
export let groupPaddingInner = 0.2; | ||
export let groupPaddingOuter = 0; | ||
export let spring: boolean | Parameters<typeof springStore>[1] = undefined; | ||
export let tweened: boolean | Parameters<typeof tweenedStore>[1] = undefined; | ||
$: if (stroke === null || stroke === undefined) stroke = 'black'; | ||
$: getDimensions = createDimensionGetter(getContext('LayerCake'), { | ||
x, | ||
y, | ||
groupBy, | ||
padding, | ||
groupPadding: { | ||
inner: groupPaddingInner, | ||
outer: groupPaddingOuter, | ||
}, | ||
}); | ||
</script> | ||
|
||
<Rect | ||
{fill} | ||
{spring} | ||
{tweened} | ||
{stroke} | ||
stroke-width={strokeWidth} | ||
rx={radius} | ||
{...$getDimensions(bar)} | ||
{...$$restProps} | ||
on:click | ||
/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ | |
'Line', | ||
'PunchCard', | ||
'Scatter', | ||
'Sparkbar', | ||
'Sparkline', | ||
'Threshold', | ||
], | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
464168a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
layerchart – ./
layerchart.vercel.app
layerchart-git-master-techniq-team.vercel.app
layerchart-techniq-team.vercel.app
www.layerchart.com
layerchart.com