-
Notifications
You must be signed in to change notification settings - Fork 201
fix(meter): update layout tokens #2080
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
ada60ea
chore(meter): updates tokens
jenndiaz 21d4560
chore(meter): wip add to storybook
jenndiaz 465a71a
chore(meter): wip as variant of progressbar
jenndiaz 98e0179
chore(meter): functioning storybook
jenndiaz 01ff937
feat(meter): add percent range to story controls
jenndiaz 4f31406
chore(meter): refactor to separate template
jenndiaz 7be03bb
chore(meter): refactor to not use mods
jenndiaz 097f47e
chore(meter): address PR feedback
jenndiaz 75ef655
chore(meter): refactor fillColor in template
jenndiaz 12a3a2d
fix(meter): address indentation error
jenndiaz f7c774a
chore(meter): mods
jenndiaz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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,92 @@ | ||
// Import the component markup template | ||
import { Template } from "./metertemplate"; | ||
|
||
export default { | ||
title: "Components/Meter", | ||
description: | ||
"The meter component is a visual representations of a quantity or an achievement. Their progress is determined by user actions, rather than system actions.", | ||
component: "ProgressBar", | ||
argTypes: { | ||
label: { | ||
name: "Label", | ||
type: { name: "string" }, | ||
table: { | ||
type: { summary: "string" }, | ||
category: "Content", | ||
}, | ||
control: "text", | ||
}, | ||
value: { | ||
mlogsdon18 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
name: "Percent value for fill", | ||
type: { name: "number" }, | ||
table: { | ||
type: { summary: "number" }, | ||
category: "Content", | ||
}, | ||
control: { type: "range", min: 0, max: 100,}, | ||
}, | ||
meterFill: { | ||
name: "Meter fill color", | ||
type: { name: "string" }, | ||
table: { | ||
type: { summary: "string" }, | ||
category: "Component", | ||
}, | ||
options: ["notice", "positive", "negative", "default"], | ||
control: "select", | ||
}, | ||
size: { | ||
name: "Meter size", | ||
type: { name: "string" }, | ||
table: { | ||
type: { summary: "string" }, | ||
category: "Component", | ||
}, | ||
options: ["s", "l"], | ||
control: "select", | ||
}, | ||
}, | ||
args: { | ||
rootClass: "spectrum-ProgressBar", | ||
label: "Storage Space", | ||
size: "s", | ||
value: 50, | ||
}, | ||
parameters: { | ||
actions: { | ||
handles: [], | ||
}, | ||
status: { | ||
type: process.env.MIGRATED_PACKAGES.includes("progressbar") | ||
? "migrated" | ||
: undefined, | ||
}, | ||
}, | ||
}; | ||
|
||
export const Default = Template.bind({}); | ||
Default.args = { | ||
meterFill: "default", | ||
}; | ||
|
||
export const Large = Template.bind({}); | ||
Large.args = { | ||
meterFill: "default", | ||
size: "l", | ||
}; | ||
|
||
|
||
export const Postive = Template.bind({}); | ||
Postive.args = { | ||
meterFill: "positive", | ||
}; | ||
|
||
export const Negative = Template.bind({}); | ||
Negative.args = { | ||
meterFill: "negative", | ||
}; | ||
|
||
export const Notice = Template.bind({}); | ||
Notice.args = { | ||
meterFill: "notice", | ||
}; |
This file contains hidden or 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,51 @@ | ||
import { html } from "lit"; | ||
import { classMap } from "lit/directives/class-map.js"; | ||
import { Template as FieldLabel } from "@spectrum-css/fieldlabel/stories/template.js"; | ||
|
||
import "../index.css"; | ||
|
||
export const Template = ({ | ||
rootClass = "spectrum-ProgressBar", | ||
customClasses = [], | ||
label, | ||
value, | ||
meterFill, | ||
size = "s", | ||
...globals | ||
}) => { | ||
|
||
return html` | ||
<div | ||
class=${classMap({ | ||
[rootClass]: true, | ||
["spectrum-Meter"]: true, | ||
[`spectrum-Meter--size${size?.toUpperCase()}`]: size, | ||
[`is-${meterFill}`]: meterFill !== "default", | ||
...customClasses.reduce((a, c) => ({ ...a, [c]: true }), {}), | ||
})} | ||
value="${value}%" | ||
role="progressbar" | ||
aria-valuenow="${value}%" | ||
aria-valuemin="0" | ||
aria-valuemax="100" | ||
> | ||
${FieldLabel({ | ||
...globals, | ||
size, | ||
label, | ||
alignment: "", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can just remove this if you don't have anything to pass through |
||
customClasses: [`${rootClass}-label`], | ||
})} | ||
${FieldLabel({ | ||
...globals, | ||
size, | ||
label: `${value}%`, | ||
alignment: "", | ||
customClasses: [`${rootClass}-percentage`], | ||
})} | ||
<div class="${rootClass}-track"> | ||
<div class="${rootClass}-fill" style="width: ${value}%;"></div> | ||
</div> | ||
</div> | ||
`; | ||
}; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.