Skip to content

Commit

Permalink
add new component vs-value-tag
Browse files Browse the repository at this point in the history
  • Loading branch information
yeriiiii committed Dec 18, 2023
1 parent c08943c commit 1c285ac
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/vlossom/src/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ export * from './vs-input-wrapper';
export * from './vs-message';
export * from './vs-page';
export * from './vs-section';
export * from './vs-wrapper';
export * from './vs-value-tag';
export * from './vs-wrapper';
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<template>
<div> </div>
</template>
<script lang="ts">
import { PropType, defineComponent, toRefs } from 'vue';
import { useColorScheme, useCustomStyle } from '@/composables';
import { ColorScheme, VsComponent } from '@/declaration/types';
interface ValueTagStyleSet {}
export type VsValueTagStyleSet = Partial<ValueTagStyleSet>;
const name = VsComponent.VsValueTag;
const VsValueTag = defineComponent({
name,
props: {
colorScheme: { type: String as PropType<ColorScheme> },
styleSet: { type: [String, Object] as PropType<string | VsValueTagStyleSet>, default: '' },
},
setup(props) {
const { colorScheme, styleSet } = toRefs(props);
const { computedColorScheme } = useColorScheme(name, colorScheme);
const { customProperties } = useCustomStyle<VsValueTagStyleSet>(name, styleSet);
return {
computedColorScheme,
customProperties,
};
},
});
export default VsValueTag;
export type VsValueTagInstance = InstanceType<typeof VsValueTag>;
</script>
<style lang="scss" scoped src="./VsValueTag.scss" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import type { App } from 'vue';
import VsValueTag from './VsValueTag.vue';

export default {
install(app: App<Element>) {
app.component('vs-value-tag', VsValueTag);
},
};
export * from './VsValueTag.vue';
2 changes: 2 additions & 0 deletions packages/vlossom/src/components/vs-value-tag/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { default as VsValueTag } from './VsValueTag';
export type { VsValueTagInstance, VsValueTagStyleSet } from './VsValueTag';
3 changes: 3 additions & 0 deletions packages/vlossom/src/declaration/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import type {
VsInputStyleSet,
VsSectionStyleSet,
VsPageStyleSet,
VsValueTagStyleSet,
} from '@/components';

export enum VsComponent {
Expand All @@ -12,6 +13,7 @@ export enum VsComponent {
VsInput = 'VsInput',
VsPage = 'VsPage',
VsSection = 'VsSection',
VsValueTag = 'VsValueTag',
}

export type ColorScheme = 'red' | 'amber' | 'green' | 'teal' | 'blue' | 'indigo' | 'purple' | 'pink';
Expand All @@ -24,6 +26,7 @@ export interface StyleSet {
VsInput?: { [key: string]: VsInputStyleSet };
VsSection?: { [key: string]: VsSectionStyleSet };
VsPage?: { [key: string]: VsPageStyleSet };
VsValueTag?: { [key: string]: VsValueTagStyleSet };
}

export interface VlossomOptions {
Expand Down

0 comments on commit 1c285ac

Please sign in to comment.