Skip to content

Commit

Permalink
fix: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
caro3801 committed Jul 15, 2024
1 parent d4798a6 commit e67b9fb
Show file tree
Hide file tree
Showing 11 changed files with 87 additions and 81 deletions.
1 change: 1 addition & 0 deletions components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ declare module 'vue' {
BatchSearchTable: typeof import('./src/components/BatchSearchTable.vue')['default']
BBadge: typeof import('bootstrap-vue-next')['BBadge']
BButton: typeof import('bootstrap-vue-next')['BButton']
BCloseButton: typeof import('bootstrap-vue-next')['BCloseButton']
BCol: typeof import('bootstrap-vue-next')['BCol']
BCollapse: typeof import('bootstrap-vue-next')['BCollapse']
BDropdown: typeof import('bootstrap-vue-next')['BDropdown']
Expand Down
2 changes: 1 addition & 1 deletion src/components/FiltersPanel/FiltersPanelSearch.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup>
import SearchFormControl from '@/components/SearchFormControl.vue'
import SearchFormControl from '@/components/SearchFormControl'
defineProps({
modelValue: {
Expand Down
2 changes: 1 addition & 1 deletion src/components/FiltersPanel/FiltersPanelSection.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup>
import FiltersPanelSectionTitle from '@/components/FiltersPanel/FiltersPanelSectionTitle.vue'
import FiltersPanelSectionTitle from '@/components/FiltersPanel/FiltersPanelSectionTitle'
defineProps({
title: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script setup>
import { computed } from 'vue'
import IconButton from '@/components/IconButton.vue'
import IconButton from '@/components/IconButton'
const props = defineProps({
collapse: {
Expand Down
2 changes: 1 addition & 1 deletion src/components/FiltersPanel/FiltersPanelToggler.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup>
import IconButton from '@/components/IconButton.vue'
import IconButton from '@/components/IconButton'
const emit = defineEmits(['close'])
</script>
Expand Down
24 changes: 8 additions & 16 deletions src/components/PageSettings/PageSettings.vue
Original file line number Diff line number Diff line change
@@ -1,28 +1,20 @@
<template>
<div class="page-settings">
<page-settings-title>{{title}}</page-settings-title>
<slot>
</slot>
<div class="d-flex justify-content-between align-items-baseline">
<page-settings-title class="pb-4">{{ title }}</page-settings-title>
<slot name="closeButton"> </slot>
</div>
<slot> </slot>
</div>
</template>

<script setup>
import PageSettingsTitle from "@/components/PageSettings/PageSettingsTitle.vue";
import PageSettingsTitle from '@/components/PageSettings/PageSettingsTitle'
const props = defineProps({
defineProps({
title: {
type: String,
required:true
required: true
}
})
</script>

<style scoped lang="scss">
.page-settings {
& &-title{
padding-bottom: 1em;
}
}
</style>
20 changes: 11 additions & 9 deletions src/components/PageSettings/PageSettingsEntry.vue
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
<template>
<span class="page-settings-entry d-inline-flex"><phosphor-icon v-if="icon" :name="icon" class="me-2"/>{{ text }}</span>
<span class="page-settings-entry d-inline-flex"
><phosphor-icon v-if="icon" :name="icon" class="me-2" />{{ text }}</span
>
</template>

<script setup>
import {PhosphorIcon} from "@icij/murmur-next";
import { PhosphorIcon } from '@icij/murmur-next'
defineOptions({
name:"PageSettingsEntry"
name: 'PageSettingsEntry'
})
const props = defineProps({
defineProps({
icon: {
type: String,
type: String
},
text: {
type: String,
Expand All @@ -21,13 +23,13 @@ const props = defineProps({
required: false
}
})
</script>

<style lang="scss">
.page-settings-entry{
:checked + label, &-checked {
font-weight: bold
.page-settings-entry {
:checked + label,
&-checked {
font-weight: bold;
}
}
</style>
62 changes: 33 additions & 29 deletions src/components/PageSettings/PageSettingsSection.vue
Original file line number Diff line number Diff line change
@@ -1,39 +1,46 @@
<template>
<page-settings-section-group :label="label" v-model="localOpen" class="page-settings-section">
<component :is="formGroup"
id="checkbox-group-1"
class="page-settings-section__input-group"
v-model="localValue"
:name="name"
stacked
<page-settings-section-group v-model="localOpen" :label="label" class="page-settings-section">
<component
:is="formGroup"
id="checkbox-group-1"
v-model="localValue"
class="page-settings-section__input-group"
:name="name"
stacked
>
<component :is="formInput" v-for="(option,index) in options" :key="index" :value="option.value" class="page-settings-section__input-group__input">
<component
:is="formInput"
v-for="(option, index) in options"
:key="index"
:value="option.value"
class="page-settings-section__input-group__input"
>
<page-settings-entry :text="option.text" :icon="option.icon" />
</component>
</component>
</page-settings-section-group>
</template>

<script setup>
import {computed} from "vue"
import PageSettingsEntry from "@/components/PageSettings/PageSettingsEntry.vue";
import PageSettingsSectionGroup from "@/components/PageSettings/PageSettingsSectionGroup.vue";
import {BFormCheckbox, BFormCheckboxGroup, BFormRadio, BFormRadioGroup} from "bootstrap-vue-next";
import { computed } from 'vue'
import { BFormCheckbox, BFormCheckboxGroup, BFormRadio, BFormRadioGroup } from 'bootstrap-vue-next'
import PageSettingsEntry from '@/components/PageSettings/PageSettingsEntry'
import PageSettingsSectionGroup from '@/components/PageSettings/PageSettingsSectionGroup'
defineOptions({
name:"PageSettingsSection"
name: 'PageSettingsSection'
})
const RADIO = "radio"
const CHECKBOX = "checkbox"
const RADIO = 'radio'
const props = defineProps({
label: {
type: String,
required: true,
required: true
},
type: {
type: String,
required: true,
validator: (inputType) => [RADIO, CHECKBOX].includes(inputType)
validator: (inputType) => ['radio', 'checkbox'].includes(inputType)
},
name: {
type: String,
Expand All @@ -43,15 +50,14 @@ const props = defineProps({
type: Object,
required: true
}
})
const modelValue = defineModel({
type: [String, Array],
default: () => [],
default: () => []
})
const open = defineModel('open',{
type:Boolean,
default: true,
const open = defineModel('open', {
type: Boolean,
default: true
})
const formGroup = computed(() => {
return props.type === RADIO ? BFormRadioGroup : BFormCheckboxGroup
Expand All @@ -68,21 +74,19 @@ const localValue = computed({
const localOpen = computed({
get: () => open.value,
set: (newVal) => {
console.log("test",newVal)
console.log('test', newVal)
open.value = newVal
}
})
</script>

<style lang="scss" scoped>
.page-settings{
&-section{
&__input-group{
margin-left: 1em !important;
.page-settings {
&-section {
&__input-group {
margin-left: 1em !important;
}
margin-bottom: 1em !important;
}
}
</style>
39 changes: 20 additions & 19 deletions src/components/PageSettings/PageSettingsSectionGroup.vue
Original file line number Diff line number Diff line change
@@ -1,48 +1,49 @@
<template>

<b-form-group class="page-settings-group">
<template #label>
<div class="page-settings-group__label d-flex"
aria-controls="page-settings-group-collapse"
:aria-expanded="modelValue ? 'true' : 'false'"
@click="toggleSection"><phosphor-icon class="d-inline-flex me-2" :name="caretIcon" />{{label}}</div>
<div
class="page-settings-group__label d-flex"
aria-controls="page-settings-group-collapse"
:aria-expanded="modelValue ? 'true' : 'false'"
@click="toggleSection"
>
<phosphor-icon class="d-inline-flex me-2" :name="caretIcon" />{{ label }}
</div>
</template>
<b-collapse id="page-settings-group-collapse" v-model="modelValue" >
<slot v-bind="{open:modelValue}"></slot>
<b-collapse id="page-settings-group-collapse" v-model="modelValue">
<slot v-bind="{ open: modelValue }"></slot>
</b-collapse>
</b-form-group>
</template>

<script setup>
import {computed, ref} from "vue";
import {PhosphorIcon} from "@icij/murmur-next";
import { computed } from 'vue'
import { PhosphorIcon } from '@icij/murmur-next'
defineOptions({
name:"PageSettingsSectionGroup"
name: 'PageSettingsSectionGroup'
})
const props = defineProps({
defineProps({
label: {
type: String,
default: 'Settings'
},
}
})
const modelValue = defineModel({
type:Boolean,
default:true
type: Boolean,
default: true
})
const caretIcon = computed(()=> modelValue.value?'caret-up':'caret-down')
const caretIcon = computed(() => (modelValue.value ? 'caret-up' : 'caret-down'))
function toggleSection(){
function toggleSection() {
modelValue.value = !modelValue.value
}
</script>
<style lang="scss">
.page-settings-group{
.page-settings-group {
&__label {
cursor: pointer;
}
}
</style>

6 changes: 3 additions & 3 deletions src/components/PageSettings/PageSettingsTitle.vue
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<script setup>
const props = defineProps({
defineProps({
title: {
type: String
}
})
</script>

<template>
<h2 class="page-settings-title">
<h3 class="page-settings-title">
<slot>{{ title }}</slot>
</h2>
</h3>
</template>

<style lang="scss" scoped>
Expand Down
8 changes: 7 additions & 1 deletion src/stories/components/PageSettings/PageSettings.stories.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
import PageSettings from '@/components/PageSettings/PageSettings.vue'
import PageSettingsSection from '@/components/PageSettings/PageSettingsSection.vue'
import {BCloseButton} from 'bootstrap-vue-next'

import { fn } from '@storybook/test'
export default {
title: 'Components/PageSettings',
tags: ['autodocs'],
render: (args) => ({
components: {
PageSettings,PageSettingsSection
PageSettings,PageSettingsSection,BCloseButton
},
setup: () => {
return {args}
},
template: `
<page-settings title="Page settings">
<template #closeButton>
<b-close-button class="d-inline-flex" @click="args.onCloseButtonClick"/>
</template>
<page-settings-section
v-model="args.example.modelValue"
v-model:open="args.example.open"
Expand Down Expand Up @@ -137,5 +142,6 @@ export const Default = {
title:"Page settings",
example,
sections,
onCloseButtonClick: fn()
}
}

0 comments on commit e67b9fb

Please sign in to comment.