Skip to content

Commit e9d6ae6

Browse files
authored
Merge pull request #3 from profcomff/checkBox
Создание VuCheckbox
2 parents ca97c41 + 029a0b9 commit e9d6ae6

10 files changed

Lines changed: 544 additions & 137 deletions

File tree

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,12 @@ pnpm sb
8282
pnpm dev
8383
```
8484

85+
Для локального запуска Storybook необходимо выполнить команду
86+
```
87+
pnpm sb
88+
```
89+
90+
8591
## Инструкции
8692

8793
### Получение кода на свой компьютер

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,11 @@
1919
"build-storybook": "storybook build"
2020
},
2121
"dependencies": {
22+
"@tailwindcss/vite": "^4.1.16",
2223
"pinia": "^3.0.1",
2324
"query-string": "^9.1.1",
2425
"storybook": "^9.1.13",
26+
"tailwindcss": "^4.1.16",
2527
"vue": "^3.5.13",
2628
"vue-router": "^4.5.0"
2729
},
@@ -53,6 +55,7 @@
5355
"knip": "^5.45.0",
5456
"openapi-typescript": "^7.6.1",
5557
"playwright": "^1.56.1",
58+
"postcss-html": "^1.8.0",
5659
"postcss-preset-env": "^10.1.5",
5760
"prettier": "^3.5.2",
5861
"sass": "^1.93.2",

pnpm-lock.yaml

Lines changed: 465 additions & 136 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/button/VuButton.stories.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const meta = {
77
component: VuButton,
88
tags: ['autodocs'],
99
args: {
10+
text: 'Привет',
1011
onClick: fn(),
1112
},
1213
} satisfies Meta<typeof VuButton>;

src/components/button/VuButton.vue

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11
<script setup lang="ts">
2+
// Определяем пропсы компонента
3+
interface Props {
4+
text?: string;
5+
}
6+
7+
// Объявляем пропсы
8+
defineProps<Props>();
9+
210
defineEmits<{
311
click: [];
412
}>();
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import { Meta, StoryObj } from '@storybook/vue3-vite';
2+
import VuCheckbox from './VuCheckbox.vue';
3+
4+
const meta = {
5+
title: 'checkBox/VuCheckbox',
6+
component: VuCheckbox,
7+
} satisfies Meta<typeof VuCheckbox>;
8+
9+
export default meta;
10+
11+
type Story = StoryObj<typeof meta>;
12+
13+
export const Default: Story = {
14+
args: {
15+
disabled: false,
16+
modelValue: false,
17+
label: "Оценок нет"
18+
},
19+
};
20+
export const Active: Story = {
21+
args: {
22+
disabled: false,
23+
modelValue: true,
24+
label: "Оценок нет"
25+
},
26+
};
27+
export const Disabled: Story = {
28+
args: {
29+
disabled: true,
30+
modelValue: true,
31+
label: "Оценок нет"
32+
},
33+
};
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<script setup lang="ts">
2+
import { computed } from 'vue';
3+
4+
interface Props {
5+
disabled: boolean;
6+
modelValue: boolean;
7+
label: string;
8+
}
9+
const props = defineProps<Props>();
10+
const emit = defineEmits(['update:modelValue'])
11+
12+
const value = computed({
13+
get: () => props.modelValue,
14+
set: (value) => emit('update:modelValue', value)
15+
})
16+
</script>
17+
18+
<template>
19+
<v-checkbox
20+
density="compact"
21+
:label="label"
22+
v-model="value"
23+
:disabled="disabled">
24+
</v-checkbox>
25+
</template>

src/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ import { createApp } from 'vue';
22
import App from '@/App.vue';
33
import { pinia } from '@/pinia';
44
import { vuetify } from './vuetify';
5-
5+
import '../style.css'
66
createApp(App).use(pinia).use(vuetify).mount('#app');

style.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@import "tailwindcss";

vite.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export default defineConfig({
1515
transformAssetUrls,
1616
},
1717
}),
18+
tailwindcss(),
1819
vuetify({
1920
autoImport: true,
2021
styles: {

0 commit comments

Comments
 (0)