-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(VsFooter) add vs-footer component
- Loading branch information
Showing
7 changed files
with
141 additions
and
0 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
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,12 @@ | ||
footer { | ||
align-items: center; | ||
justify-content: center; | ||
background-color: var(--vs-footer-backgroundColor, var(--vs-area-backgroundColor)); | ||
color: var(--vs-footer-fontColor, var(--vs-font-color)); | ||
display: flex; | ||
flex-direction: column; | ||
flex: 1 1 auto; | ||
height: auto; | ||
padding: var(--vs-footer-padding, 0.5rem 1rem); | ||
width: var(--vs-footer-width, 100%); | ||
} |
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,58 @@ | ||
<template> | ||
<footer ref="vnFooterRef" :class="['vs-footer', `vs-${computedColorScheme}`]" :style="customProperties"> | ||
<slot /> | ||
</footer> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { PropType, computed, defineComponent, toRefs, watch, ref, nextTick, onMounted } from 'vue'; | ||
import { useColorScheme, useCustomStyle } from '@/composables'; | ||
import { ColorScheme, VsComponent } from '@/declaration/types'; | ||
interface FooterStyleSet { | ||
backgroundColor: string; | ||
color: string; | ||
} | ||
export type VsFooterStyleSet = Partial<FooterStyleSet>; | ||
const name = VsComponent.VsFooter; | ||
export default defineComponent({ | ||
name, | ||
props: { | ||
colorScheme: { type: String as PropType<ColorScheme> }, | ||
styleSet: { type: [String, Object] as PropType<string | VsFooterStyleSet>, default: '' }, | ||
}, | ||
setup(props) { | ||
const { colorScheme, styleSet } = toRefs(props); | ||
const { computedColorScheme } = useColorScheme(name, colorScheme); | ||
const customProperties = useCustomStyle<VsFooterStyleSet>(name, styleSet); | ||
const vnFooterRef = ref<HTMLElement | null>(null); | ||
// watch( | ||
// height, | ||
// (value) => { | ||
// nextTick(() => { | ||
// const vnApp = document.querySelector<HTMLElement>('#vn-app'); | ||
// if (vnApp && vnFooterRef.value?.parentNode === vnApp) { | ||
// vnApp.style.setProperty('--vn-footer-height', value); | ||
// } | ||
// }); | ||
// }, | ||
// { immediate: true } | ||
// ); | ||
return { | ||
computedColorScheme, | ||
customProperties, | ||
vnFooterRef, | ||
}; | ||
}, | ||
}); | ||
</script> | ||
|
||
<style lang="scss" scoped src="./VsFooter.scss" /> |
3 changes: 3 additions & 0 deletions
3
packages/vlossom/src/components/vs-footer/__test__/vs-footer.test.ts
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,3 @@ | ||
import { describe } from 'vitest'; | ||
|
||
describe('vs-footer', () => {}); |
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,12 @@ | ||
import { VsComponent } from '@/declaration/types'; | ||
import VsFooter from './VsFooter.vue'; | ||
import type { VsFooterStyleSet } from './VsFooter.vue'; | ||
|
||
type VsFooterInstance = InstanceType<typeof VsFooter>; | ||
|
||
export type { VsFooterInstance, VsFooterStyleSet }; | ||
|
||
export default { | ||
name: VsComponent.VsFooter, | ||
component: VsFooter, | ||
}; |
52 changes: 52 additions & 0 deletions
52
packages/vlossom/src/components/vs-footer/stories/VsFooter.stories.ts
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,52 @@ | ||
import type { Meta, StoryObj } from '@storybook/vue3'; | ||
import { colorScheme } from '@/storybook/args'; | ||
import VsFooter from './../VsFooter.vue'; | ||
|
||
const lorem = `Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum | ||
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum | ||
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum | ||
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum | ||
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum | ||
.`; | ||
|
||
const meta: Meta<typeof VsFooter> = { | ||
title: 'Components/Layout Components/VsFooter', | ||
component: VsFooter, | ||
render: (args: any) => ({ | ||
components: { VsFooter }, | ||
setup() { | ||
return { args, lorem }; | ||
}, | ||
template: '<vs-footer v-bind="args" style="height: 300px;"> This is Footer </vs-footer>', | ||
// template: '<vs-footer v-bind="args" > <div>content1</div>{{ lorem }} <div>content2</div> </vs-footer>', | ||
}), | ||
tags: ['autodocs'], | ||
argTypes: { | ||
colorScheme, | ||
}, | ||
}; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof VsFooter>; | ||
|
||
export const Default: Story = {}; | ||
|
||
export const ColorScheme: Story = { | ||
render: () => ({ | ||
components: { VsFooter }, | ||
setup() { | ||
const colorOptions = [...colorScheme.options]; | ||
return { colorOptions }; | ||
}, | ||
template: ` | ||
<div> | ||
<vs-footer v-for="(color, index) in colorOptions" :key="index" :color-scheme="color" | ||
:style="{marginBottom: '1rem'}" | ||
> | ||
This is Footer | ||
</vs-footer> | ||
</div> | ||
`, | ||
}), | ||
}; |
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