Skip to content
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

Release 1.0.1 #64

Merged
merged 17 commits into from
Sep 25, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
## [1.0.1-next.1](https://github.com/warp-ds/vue/compare/v1.0.0...v1.0.1-next.1) (2023-09-04)


### Bug Fixes

* add test case for negative button as it is not just modifier anymore but it is own button type ([#63](https://github.com/warp-ds/vue/issues/63)) ([c9d4950](https://github.com/warp-ds/vue/commit/c9d4950278ee7bbddc80709b3a2161009c15aa2a))
* use new button classes and improve conditions ([#62](https://github.com/warp-ds/vue/issues/62)) ([1c9fa6c](https://github.com/warp-ds/vue/commit/1c9fa6c4326d2527f1db58f6d94c19ab3e215031))

## [1.0.1-next.1](https://github.com/warp-ds/vue/compare/v1.0.0...v1.0.1-next.1) (2023-09-01)


### Bug Fixes

* use new button classes and improve conditions ([#62](https://github.com/warp-ds/vue/issues/62)) ([1c9fa6c](https://github.com/warp-ds/vue/commit/1c9fa6c4326d2527f1db58f6d94c19ab3e215031))

# 1.0.0 (2023-08-31)


Expand Down
59 changes: 44 additions & 15 deletions components/button/w-button.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,22 +50,51 @@ const props = defineProps({
label: String,
})

const buttonType = buttonTypes.find(b => !!props[b]);

const buttonClass = computed(() => ({
[ccButton.buttonSecondary]: props.secondary && !props.quiet || !buttonTypes.find(b => !!props[b]),
// primary buttons
[ccButton.buttonPrimary]: props.primary && !props.negative,
[ccButton.buttonDestructive]: props.primary && props.negative,
// quiet
[ccButton.buttonFlat]: (props.secondary || (!props.negative && !props.utility)) && props.quiet,
[ccButton.buttonDestructiveFlat]: props.negative && props.quiet,
[ccButton.buttonUtilityFlat]: props.utility && props.quiet,
// others
[ccButton.buttonSmall]: props.small,
[ccButton.buttonUtility]: props.utility && !props.quiet,
[ccButton.buttonLink]: props.link,
[ccButton.buttonPill]: props.pill,
[ccButton.buttonInProgress]: props.loading,
[ccButton.buttonIsDisabled]: props.disabled,
[ccButton.secondary]: (props.secondary || !buttonType) && !props.small && !props.quiet && !props.loading,
[ccButton.secondarySmall]: props.secondary && props.small && !props.quiet && !props.loading,
[ccButton.secondarySmallLoading]: props.secondary && props.small && !props.quiet && props.loading,
[ccButton.secondarySmallQuiet]: props.secondary && props.small && props.quiet && !props.loading,
[ccButton.secondarySmallQuietLoading]: props.secondary && props.small && props.quiet && props.loading,
[ccButton.secondaryQuiet]: props.secondary && !props.small && props.quiet && !props.loading,
[ccButton.secondaryQuietLoading]: props.secondary && !props.small && props.quiet && props.loading,
[ccButton.secondaryLoading]: props.secondary && !props.small && !props.quiet && props.loading,

[ccButton.primary]: props.primary && !props.small && !props.quiet && !props.loading,
[ccButton.primarySmall]: props.primary && props.small && !props.quiet && !props.loading,
[ccButton.primarySmallQuiet]: props.primary && props.small && props.quiet && !props.loading,
[ccButton.primarySmallLoading]: props.primary && props.small && !props.quiet && props.loading,
[ccButton.primarySmallQuietLoading]: props.primary && props.small && props.quiet && props.loading,
[ccButton.primaryQuiet]: props.primary && !props.small && props.quiet && !props.loading,
[ccButton.primaryQuietLoading]: props.primary && !props.small && props.quiet && props.loading,
[ccButton.primaryLoading]: props.primary && !props.small && !props.quiet && props.loading,

[ccButton.utility]: props.utility && !props.small && !props.quiet && !props.loading,
[ccButton.utilitySmall]: props.utility && props.small && !props.quiet && !props.loading,
[ccButton.utilitySmallQuiet]: props.utility && props.small && props.quiet && !props.loading,
[ccButton.utilitySmallLoading]: props.utility && props.small && !props.quiet && props.loading,
[ccButton.utilitySmallQuietLoading]: props.utility && props.small && props.quiet && props.loading,
[ccButton.utilityQuiet]: props.utility && !props.small && props.quiet && !props.loading,
[ccButton.utilityQuietLoading]: props.utility && !props.small && props.quiet && props.loading,
[ccButton.utilityLoading]: props.utility && !props.small && !props.quiet && props.loading,

[ccButton.negative]: props.negative && !props.small && !props.quiet && !props.loading,
[ccButton.negativeSmall]: props.negative && props.small && !props.quiet && !props.loading,
[ccButton.negativeSmallQuiet]: props.negative && props.small && props.quiet && !props.loading,
[ccButton.negativeSmallLoading]: props.negative && props.small && !props.quiet && props.loading,
[ccButton.negativeSmallQuietLoading]: props.negative && props.small && props.quiet && props.loading,
[ccButton.negativeQuiet]: props.negative && !props.small && props.quiet && !props.loading,
[ccButton.negativeQuietLoading]: props.negative && !props.small && props.quiet && props.loading,
[ccButton.negativeLoading]: props.negative && !props.small && !props.quiet && props.loading,

[ccButton.pill]: props.pill && !props.small && !props.loading,
[ccButton.pillSmall]: props.pill && props.small && !props.loading,
[ccButton.pillLoading]: props.pill && !props.small && props.loading,
[ccButton.pillSmallLoading]: props.pill && props.small && props.loading,
[ccButton.link]: props.link && !props.small,
[ccButton.linkSmall]: props.link && props.small,
[ccButton.linkAsButton]: !!props.href,
}))

Expand Down
4 changes: 2 additions & 2 deletions dev/pages/Button.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ const active = useIsActive(variants)
const variantControls = [
{ name: 'Primary', radio },
{ name: 'Secondary', radio },
{ name: 'Negative', radio },
{ name: 'Link', radio },
{ name: 'Utility', radio },
{ name: 'Pill', radio },
]

const modifierControls = [
{ name: 'Negative', checkbox },
{ name: 'Quiet', checkbox },
{ name: 'Small', checkbox },
{ name: 'Loading', checkbox }
Expand All @@ -30,7 +30,7 @@ const modifiers = reactive(buildCheckboxState({ controls: modifierControls }))
<w-button
:primary="active('Primary')"
:secondary="active('Secondary')"
:negative="modifiers.Negative"
:negative="active('Negative')"
:link="active('Link')"
:utility="active('Utility')"
:pill="active('Pill')"
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@warp-ds/vue",
"repository": "git@github.com:warp-ds/vue.git",
"version": "1.0.0",
"version": "1.0.1-next.1",
"description": "Warp components for Vue 3",
"type": "module",
"exports": {
Expand Down Expand Up @@ -32,7 +32,7 @@
"dependencies": {
"@lingui/core": "^4.3.0",
"@warp-ds/core": "^1.0.0",
"@warp-ds/css": "^1.0.0",
"@warp-ds/css": "^1.0.1",
"@warp-ds/uno": "^1.0.0",
"@floating-ui/dom": "^1.5.1",
"create-v-model": "^2.2.0",
Expand Down
26 changes: 10 additions & 16 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion test/wButton.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@ describe('button', () => {
test('primary', () => {
const wrapper = mount(wButton, { props: { primary: true, label } })
assert.equal(wrapper.text(), 'Hello Warp')
assert.include(wrapper.classes().join(' '), ccButton.buttonPrimary)
assert.include(wrapper.classes().join(' '), ccButton.primary)
})
test('negative', () => {
const wrapper = mount(wButton, { props: { negative: true, label } })
assert.equal(wrapper.text(), 'Hello Warp')
assert.include(wrapper.classes().join(' '), ccButton.negative)
})
test('href', () => {
const href = 'https://finn.no'
Expand Down