Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
393802e
компонент со стилями и кнопками
Dmatrushka19 Oct 31, 2025
1026442
стори для сторибука
Dmatrushka19 Oct 31, 2025
1882d34
исправил ошибки pnpm check
Dmatrushka19 Oct 31, 2025
6362935
версия 2
Dmatrushka19 Oct 31, 2025
9c5fd01
возврат
Dmatrushka19 Oct 31, 2025
e8ac583
добавил vuetify в import
Dmatrushka19 Nov 2, 2025
c037475
упростил
Dmatrushka19 Nov 2, 2025
3ea2136
простой. окончательный вариант VuSearch, удоавлетворяющий ТЗ.
Dmatrushka19 Nov 2, 2025
582c0e6
не работает hovered, все остальное хорошо
Dmatrushka19 Nov 2, 2025
fc6272c
pseudo states addon
BatuevIO Nov 3, 2025
f4a5b2d
убрал лишние стили
Dmatrushka19 Nov 7, 2025
96ddc6d
упростил, реализовал псевдо-состояния
Dmatrushka19 Nov 7, 2025
faf8523
в псевдо-состоянии Active заменил active:true -> focus:true
Dmatrushka19 Nov 7, 2025
e344456
Использую корректный способ показать активное состояние - добавляю эт…
Dmatrushka19 Nov 11, 2025
2a2c110
удалил файлы в components
Dmatrushka19 Nov 12, 2025
8ab3be9
создал файлы в components/Search
Dmatrushka19 Nov 12, 2025
862dde0
внес исправления после код ревью
Dmatrushka19 Nov 12, 2025
a4af1d2
Merge branch 'main' into VuSearch
BatuevIO Nov 13, 2025
6cf38c9
merge and some fixes
BatuevIO Nov 13, 2025
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
1 change: 1 addition & 0 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const config: StorybookConfig = {
'@storybook/addon-onboarding',
'@storybook/addon-a11y',
'@storybook/addon-vitest',
'storybook-addon-pseudo-states',
],
framework: {
name: '@storybook/vue3-vite',
Expand Down
1 change: 1 addition & 0 deletions .storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'vuetify/styles';
import { vuetify } from '@/vuetify';
import { type Preview, setup } from '@storybook/vue3-vite';
import { withVuetifyTheme } from './withVuetifyTheme.decorator';
Expand Down
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,17 @@ pnpm sb
2. Создай в этой папке файл `Vu{НазваниеКомпонента}.vue` и в нем описываем шаблон компонента.
3. Стилизуй компонент с помощью классов vuetify.
4. Опиши модели и пропы, которые может принимать компонент. С помощью /\*\* \*/ опиши пропы и модели (так автоматически генерируется документация).
5. В этой же папке создай `Vu{НазваниеКомпонента}.stories.ts`.
6. В этом файле опиши meta, а потом истории -- различные состояния и опции компонента. Подробнее смотри в туториале Storybook или в уже написанных компонентах.
5. Чтобы отразить псевдо-состяния (hover, active и т.д.), напиши в истории:
```ts
parameters: {
pseudo: {
hover: true,
}
}
```
или посмотри [доку](https://storybook.js.org/addons/storybook-addon-pseudo-states) аддона.
6. В этой же папке создай `Vu{НазваниеКомпонента}.stories.ts`.
7. В этом файле опиши meta, а потом истории -- различные состояния и опции компонента. Подробнее смотри в туториале Storybook или в уже написанных компонентах.

### Пулл-реквест

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
"prettier": "^3.5.2",
"sass": "^1.93.2",
"sass-loader": "^16.0.6",
"storybook-addon-pseudo-states": "^10.0.3",
"stylelint": "^16.15.0",
"stylelint-config-recommended": "^15.0.0",
"stylelint-config-recommended-vue": "^1.6.0",
Expand Down
8 changes: 8 additions & 0 deletions pnpm-lock.yaml

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

57 changes: 57 additions & 0 deletions src/components/Search/VuSearch.stories.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import type { Meta, StoryObj } from '@storybook/vue3-vite';
import { fn } from 'storybook/test';
import VuSearch from './VuSearch.vue';

const meta = {
title: 'Viribus Unitis/Search',
component: VuSearch,
tags: ['autodocs'],
args: {
'onClick:filter': fn(),
'onUpdate:modelValue': fn(),
placeholder: 'Поиск преподавателя',
},
argTypes: {
modelValue: {
control: 'text',
description: 'Значение v-model',
},
placeholder: {
control: 'text',
description: 'Текст плейсхолдера',
},
},
} satisfies Meta<typeof VuSearch>;

export default meta;
type Story = StoryObj<typeof meta>;

export const Default: Story = {
args: {
modelValue: '',
},
};

export const WithValue: Story = {
args: {
modelValue: 'Поисковый запрос',
},
};

export const Hovered: Story = {
parameters: {
pseudo: {
hover: true,
},
},
};

export const Active: Story = {
args: {
modelValue: 'Печатаем...',
},
play: ({ canvasElement }) => {
const field = canvasElement.querySelector('.v-field');
field?.classList.add('v-field--focused');
},
};
26 changes: 26 additions & 0 deletions src/components/Search/VuSearch.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<script setup lang="ts">
const modelValue = defineModel<string>();

defineEmits<{
(e: 'update:modelValue', value: string): void;
(e: 'click:filter'): void;
}>();

defineProps<{
placeholder?: string;
}>();
</script>

<template>
<v-text-field
v-model="modelValue"
class="text-body-1"
:placeholder="placeholder"
hide-details="auto"
density="compact"
variant="outlined"
prepend-inner-icon="mdi-magnify"
append-inner-icon="mdi-filter-variant"
@click:append-inner="$emit('click:filter')"
/>
</template>
8 changes: 7 additions & 1 deletion src/components/button/VuButton.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,10 @@ export default meta;

type Story = StoryObj<typeof meta>;

export const Default: Story = {};
export const Default: Story = {
parameters: {
pseudo: {
active: true,
},
},
};
8 changes: 4 additions & 4 deletions src/components/checkBox/VuCheckbox.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Meta, StoryObj } from '@storybook/vue3-vite';
import VuCheckbox from './VuCheckbox.vue';

const meta = {
title: 'checkBox/VuCheckbox',
title: 'Viribus Unitis/VuCheckbox',
component: VuCheckbox,
} satisfies Meta<typeof VuCheckbox>;

Expand All @@ -14,20 +14,20 @@ export const Default: Story = {
args: {
disabled: false,
modelValue: false,
label: "Оценок нет"
label: 'Оценок нет',
},
};
export const Active: Story = {
args: {
disabled: false,
modelValue: true,
label: "Оценок нет"
label: 'Оценок нет',
},
};
export const Disabled: Story = {
args: {
disabled: true,
modelValue: true,
label: "Оценок нет"
label: 'Оценок нет',
},
};
36 changes: 17 additions & 19 deletions src/components/checkBox/VuCheckbox.vue
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
<script setup lang="ts">
import { computed } from 'vue';
defineProps({
modelValue: {
type: Boolean,
default: false,
},
label: String,
disabled: Boolean,
});

interface Props {
disabled: boolean;
modelValue: boolean;
label: string;
}
const props = defineProps<Props>();
const emit = defineEmits(['update:modelValue'])

const value = computed({
get: () => props.modelValue,
set: (value) => emit('update:modelValue', value)
})
defineEmits(['update:modelValue']);
</script>

<template>
<v-checkbox
density="compact"
:label="label"
v-model="value"
:disabled="disabled">
</v-checkbox>
<v-checkbox
density="compact"
:label="label"
:model-value="modelValue"
@update:model-value="$emit('update:modelValue', $event)"
:disabled="disabled"
>
</v-checkbox>
</template>
2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ import { createApp } from 'vue';
import App from '@/App.vue';
import { pinia } from '@/pinia';
import { vuetify } from './vuetify';
import '../style.css'
import '../style.css';
createApp(App).use(pinia).use(vuetify).mount('#app');
1 change: 0 additions & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ export default defineConfig({
transformAssetUrls,
},
}),
tailwindcss(),
vuetify({
autoImport: true,
styles: {
Expand Down