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

Merge UIButtonRadio with UITag #968

Merged
merged 2 commits into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
2 changes: 1 addition & 1 deletion spx-gui/src/components/asset/library/AssetLibraryModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ async function handleAssetClick(asset: AssetData) {
padding: var(--ui-gap-middle);
gap: 12px;

background: var(--ui-color-grey-200);
border-right: 1px solid var(--ui-color-grey-400);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UITag 的改动影响到 AssetLibraryModal 的样式,这里本来是背景色区分,调整为分隔线

}
.main {
flex: 1 1 0;
Expand Down
7 changes: 5 additions & 2 deletions spx-gui/src/components/ui/UITag.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,18 @@ defineProps<{
border-radius: var(--ui-border-radius-2);
cursor: pointer;
white-space: nowrap;
transition: .3s;

&.type-primary {
color: var(--ui-color-grey-100);
background: var(--ui-color-primary-main);
border-color: var(--ui-color-primary-main);
}

&.type-boring {
background: var(--ui-color-grey-600);
border-color: var(--ui-color-grey-600);
color: var(--ui-color-grey-900);
background: var(--ui-color-grey-300);
border-color: var(--ui-color-grey-300);
}
}
</style>
46 changes: 0 additions & 46 deletions spx-gui/src/components/ui/button-radio/UIButtonRadio.vue

This file was deleted.

2 changes: 0 additions & 2 deletions spx-gui/src/components/ui/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,4 @@ export { default as UIEditorBackdropItem } from './block-items/UIEditorBackdropI
export { default as UIBackdropItem } from './block-items/UIBackdropItem.vue'
export { default as UIEditorWidgetItem } from './block-items/UIEditorWidgetItem.vue'
export { default as UIPagination } from './UIPagination.vue'
export { default as UIButtonRadioGroup } from './button-radio/UIButtonRadioGroup.vue'
export { default as UIButtonRadio } from './button-radio/UIButtonRadio.vue'
export * from './select'
27 changes: 27 additions & 0 deletions spx-gui/src/components/ui/radio/UITagRadio.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<template>
<UITag
:type="isActive ? 'primary' : 'boring'"
@click="handleClick"
>
<slot></slot>
</UITag>
</template>

<script setup lang="ts">
import { inject, computed } from 'vue'
import UITag from '../UITag.vue'
import { radioGroupValueKey, updateRadioValueKey } from './UITagRadioGroup.vue'

const props = defineProps<{
value: string
}>()

const radioGroupValue = inject(radioGroupValueKey)
const updateRadioValue = inject(updateRadioValueKey)

const isActive = computed(() => radioGroupValue?.value === props.value)

const handleClick = () => {
updateRadioValue?.(props.value)
}
</script>
3 changes: 3 additions & 0 deletions spx-gui/src/components/ui/radio/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
export { default as UIRadio } from './UIRadio.vue'
export { default as UIRadioGroup } from './UIRadioGroup.vue'
// TODO: consider merging `UITagRadio` with `UIRadio` (with prop `style="tag"`)
export { default as UITagRadio } from './UITagRadio.vue'
export { default as UITagRadioGroup } from './UITagRadioGroup.vue'
Loading