@geckou/ui-vue 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +253 -0
- package/dist/assets/scss/functions.scss +6 -0
- package/dist/assets/scss/mixin.scss +33 -0
- package/dist/components/ArticleList/Card/Artistic.vue +310 -0
- package/dist/components/ArticleList/Card/Entertainment.vue +244 -0
- package/dist/components/ArticleList/Card/Gallery.vue +254 -0
- package/dist/components/ArticleList/Card/Grid.vue +247 -0
- package/dist/components/ArticleList/Card/News.vue +150 -0
- package/dist/components/ArticleList/Card/Rounded.vue +154 -0
- package/dist/components/ArticleList/Card/Row.vue +167 -0
- package/dist/components/ArticleList/Card/Simple.vue +232 -0
- package/dist/components/ArticleList/Card/Standard.vue +187 -0
- package/dist/components/ArticleList/Card/Tile.vue +171 -0
- package/dist/components/ArticleList/GenericArticleList.vue +143 -0
- package/dist/components/ArticleList/List/Artistic.vue +24 -0
- package/dist/components/ArticleList/List/Entertainment.vue +24 -0
- package/dist/components/ArticleList/List/Gallery.vue +24 -0
- package/dist/components/ArticleList/List/Grid.vue +216 -0
- package/dist/components/ArticleList/List/News.vue +24 -0
- package/dist/components/ArticleList/List/Rounded.vue +24 -0
- package/dist/components/ArticleList/List/Row.vue +24 -0
- package/dist/components/ArticleList/List/Simple.vue +24 -0
- package/dist/components/ArticleList/List/Standard.vue +24 -0
- package/dist/components/ArticleList/List/Tile.vue +24 -0
- package/dist/components/ArticleList/Parts/AuthorInfo.vue +100 -0
- package/dist/components/ArticleList/Parts/CardContainer.vue +23 -0
- package/dist/components/ArticleList/Parts/CardHeading.vue +43 -0
- package/dist/components/ArticleList/Parts/CategoryList.vue +41 -0
- package/dist/components/ArticleList/Parts/ExcerptText.vue +43 -0
- package/dist/components/ArticleList/Parts/MetadataList.vue +120 -0
- package/dist/components/ArticleList/Parts/NoImage.vue +36 -0
- package/dist/components/ArticleList/Parts/PostedDate.vue +41 -0
- package/dist/components/ArticleList/Parts/TagList.vue +41 -0
- package/dist/components/ArticleList/Parts/ThumbnailImage.vue +85 -0
- package/dist/components/BasicButton.vue +143 -0
- package/dist/components/CheckBox.vue +140 -0
- package/dist/components/CheckBoxes.vue +100 -0
- package/dist/components/CheckButton.vue +127 -0
- package/dist/components/DatePicker.vue +234 -0
- package/dist/components/DateRangePicker.vue +85 -0
- package/dist/components/DateSelector.vue +273 -0
- package/dist/components/DropdownUi.vue +118 -0
- package/dist/components/ErrorMessage.vue +61 -0
- package/dist/components/Icon/CalendarIcon.vue +8 -0
- package/dist/components/Icon/CheckIcon.vue +8 -0
- package/dist/components/Icon/CloseIcon.vue +8 -0
- package/dist/components/Icon/Folder.vue +8 -0
- package/dist/components/Icon/Image.vue +14 -0
- package/dist/components/Icon/KeyboardArrowDownIcon.vue +8 -0
- package/dist/components/Icon/Tag.vue +8 -0
- package/dist/components/InputBox.vue +134 -0
- package/dist/components/InputGroup.vue +41 -0
- package/dist/components/LabeledCheckbox.vue +82 -0
- package/dist/components/LabeledFieldset.vue +41 -0
- package/dist/components/LoadingSpinner.vue +56 -0
- package/dist/components/ModalBox.vue +192 -0
- package/dist/components/PopupBox.vue +93 -0
- package/dist/components/RadioButtons.vue +163 -0
- package/dist/components/SelectBox.vue +166 -0
- package/dist/components/SlideDownUi.vue +123 -0
- package/dist/components/TabUI.vue +123 -0
- package/dist/components/TextArea.vue +115 -0
- package/dist/components/TextBox.vue +111 -0
- package/dist/components/TextButton.vue +47 -0
- package/dist/components/ToggleButton.vue +179 -0
- package/dist/const/index.ts +2 -0
- package/dist/const/list-theme.ts +62 -0
- package/dist/index.ts +126 -0
- package/dist/scripts/form-validation-manager.ts +63 -0
- package/dist/scripts/utils.ts +36 -0
- package/dist/types/custom.d.ts +1 -0
- package/dist/types/index.d.ts +93 -0
- package/dist/types/vue-shim.d.ts +5 -0
- package/package.json +44 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
defineProps<{ path: string }>()
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<template>
|
|
6
|
+
<a
|
|
7
|
+
:href="path"
|
|
8
|
+
:class="$style.container"
|
|
9
|
+
>
|
|
10
|
+
<slot />
|
|
11
|
+
</a>
|
|
12
|
+
</template>
|
|
13
|
+
|
|
14
|
+
<style lang="scss" module>
|
|
15
|
+
.container {
|
|
16
|
+
position : relative;
|
|
17
|
+
display : grid;
|
|
18
|
+
width : 100%;
|
|
19
|
+
height : 100%;
|
|
20
|
+
background-color: var(--base-color);
|
|
21
|
+
text-decoration : none;
|
|
22
|
+
}
|
|
23
|
+
</style>
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
withDefaults(defineProps<{
|
|
3
|
+
heading: string
|
|
4
|
+
color?: string
|
|
5
|
+
fontSize?: string
|
|
6
|
+
fontWeight?: string
|
|
7
|
+
}>(), {
|
|
8
|
+
color : 'var(--primary-color)',
|
|
9
|
+
fontSize : 'larger',
|
|
10
|
+
fontWeight: 'bold',
|
|
11
|
+
})
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<template>
|
|
15
|
+
<div
|
|
16
|
+
:class="$style.heading"
|
|
17
|
+
:style="{
|
|
18
|
+
'--heading-color' : color,
|
|
19
|
+
'--heading-font-size' : fontSize,
|
|
20
|
+
'--heading-font-weight': fontWeight,
|
|
21
|
+
}"
|
|
22
|
+
>
|
|
23
|
+
<h2>
|
|
24
|
+
{{ heading }}
|
|
25
|
+
</h2>
|
|
26
|
+
</div>
|
|
27
|
+
</template>
|
|
28
|
+
|
|
29
|
+
<style lang="scss" module>
|
|
30
|
+
@use '../../../assets/scss/mixin' as *;
|
|
31
|
+
|
|
32
|
+
.heading {
|
|
33
|
+
@include textEllipsis(2);
|
|
34
|
+
block-size: max-content;
|
|
35
|
+
|
|
36
|
+
> h2 {
|
|
37
|
+
color : var(--heading-color);
|
|
38
|
+
font-size : var(--heading-font-size);
|
|
39
|
+
font-weight: var(--heading-font-weight);
|
|
40
|
+
margin : 0;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
</style>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type {
|
|
3
|
+
Category,
|
|
4
|
+
} from '../../../types'
|
|
5
|
+
import type { ComputedRef } from 'vue'
|
|
6
|
+
import { computed } from 'vue'
|
|
7
|
+
import MetadataList from '../../../components/ArticleList/Parts/MetadataList.vue'
|
|
8
|
+
|
|
9
|
+
const props = defineProps<{
|
|
10
|
+
categoryIds: string[]
|
|
11
|
+
categoryData: Category[]
|
|
12
|
+
icon?: {
|
|
13
|
+
color?: string
|
|
14
|
+
size?: 'small' | 'medium'
|
|
15
|
+
}
|
|
16
|
+
label?: {
|
|
17
|
+
backgroundColor?: string
|
|
18
|
+
color?: string
|
|
19
|
+
fontSize?: string
|
|
20
|
+
fontWeight?: string
|
|
21
|
+
shape?: | 'square' | 'rounded'
|
|
22
|
+
}
|
|
23
|
+
delimiter?: string
|
|
24
|
+
}>()
|
|
25
|
+
|
|
26
|
+
const returnCatNameFromCatId = (categories: Category[], categoryId: string) => categories.length ? categories.find(category => category.id === categoryId)?.name ?? '' : ''
|
|
27
|
+
const categories: ComputedRef<string[]> = computed(() => props.categoryIds.map((id: string) => returnCatNameFromCatId(props.categoryData, id)))
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
<template>
|
|
31
|
+
<MetadataList
|
|
32
|
+
:metadata="categories"
|
|
33
|
+
:icon="{
|
|
34
|
+
name : icon?.color ? 'FolderIcon' : null,
|
|
35
|
+
color: icon?.color,
|
|
36
|
+
size : icon?.size,
|
|
37
|
+
}"
|
|
38
|
+
:label="label"
|
|
39
|
+
:delimiter="delimiter"
|
|
40
|
+
/>
|
|
41
|
+
</template>
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
withDefaults(defineProps<{
|
|
3
|
+
excerpt: string
|
|
4
|
+
color?: string
|
|
5
|
+
fontSize?: string
|
|
6
|
+
row?: number
|
|
7
|
+
}>(), {
|
|
8
|
+
color : 'var(--text-color)',
|
|
9
|
+
fontSize: 'medium',
|
|
10
|
+
row : 3,
|
|
11
|
+
})
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<template>
|
|
15
|
+
<!-- eslint-disable vue/no-v-html -- WordPress の excerpt.rendered は HTML を含むため意図的に描画する -->
|
|
16
|
+
<div
|
|
17
|
+
:class="$style.excerpt"
|
|
18
|
+
:style="{
|
|
19
|
+
'--excerpt-color': color,
|
|
20
|
+
'--excerpt-font-size': fontSize,
|
|
21
|
+
'--excerpt-row': row,
|
|
22
|
+
}"
|
|
23
|
+
v-html="excerpt"
|
|
24
|
+
/>
|
|
25
|
+
</template>
|
|
26
|
+
|
|
27
|
+
<style lang="scss" module>
|
|
28
|
+
@use '../../../assets/scss/mixin' as *;
|
|
29
|
+
|
|
30
|
+
.excerpt {
|
|
31
|
+
color : var(--excerpt-color);
|
|
32
|
+
font-size: var(--excerpt-font-size);
|
|
33
|
+
|
|
34
|
+
> * {
|
|
35
|
+
@include textEllipsis(var(--excerpt-row));
|
|
36
|
+
margin: 0;
|
|
37
|
+
|
|
38
|
+
&:not(:first-child) {
|
|
39
|
+
display: none;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
</style>
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import FolderIcon from '../../../components/Icon/Folder.vue'
|
|
3
|
+
import TagIcon from '../../../components/Icon/Tag.vue'
|
|
4
|
+
|
|
5
|
+
const props = withDefaults(defineProps<{
|
|
6
|
+
metadata: string[]
|
|
7
|
+
icon?: {
|
|
8
|
+
name?: 'FolderIcon' | 'TagIcon' | null
|
|
9
|
+
color?: string
|
|
10
|
+
size?: 'small' | 'medium'
|
|
11
|
+
}
|
|
12
|
+
label?: {
|
|
13
|
+
backgroundColor?: string
|
|
14
|
+
color?: string
|
|
15
|
+
fontSize?: string
|
|
16
|
+
fontWeight?: string
|
|
17
|
+
shape?: | 'square' | 'rounded'
|
|
18
|
+
}
|
|
19
|
+
delimiter?: string
|
|
20
|
+
}>(), {
|
|
21
|
+
icon: () => ({
|
|
22
|
+
name : null,
|
|
23
|
+
color: 'var(--disable-text-color)',
|
|
24
|
+
size : 'medium',
|
|
25
|
+
}),
|
|
26
|
+
label: () => ({
|
|
27
|
+
backgroundColor: 'transparent',
|
|
28
|
+
color : 'var(--text-color)',
|
|
29
|
+
fontSize : 'var(--fs-small)',
|
|
30
|
+
fontWeight : 'normal',
|
|
31
|
+
shape : 'square',
|
|
32
|
+
}),
|
|
33
|
+
delimiter: '',
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
const iconName = props.icon.name === 'FolderIcon' ? FolderIcon : TagIcon
|
|
37
|
+
</script>
|
|
38
|
+
|
|
39
|
+
<template>
|
|
40
|
+
<div
|
|
41
|
+
v-if="metadata.length"
|
|
42
|
+
:class="$style.metadata_list"
|
|
43
|
+
:style="{ '--icon-color': icon.color }"
|
|
44
|
+
>
|
|
45
|
+
<component
|
|
46
|
+
:is="iconName"
|
|
47
|
+
v-if="icon.name"
|
|
48
|
+
:class="$style.icon"
|
|
49
|
+
:style="{
|
|
50
|
+
'--icon-color': icon.color,
|
|
51
|
+
'--icon-size' : icon.size === 'small' ? 'var(--small-icon-size)' : 'var(--medium-icon-size)',
|
|
52
|
+
}"
|
|
53
|
+
/>
|
|
54
|
+
<ul :class="$style.list">
|
|
55
|
+
<li
|
|
56
|
+
v-for="item in metadata"
|
|
57
|
+
:key="item"
|
|
58
|
+
:class="[
|
|
59
|
+
$style.list_item,
|
|
60
|
+
$style[label.shape ?? 'square'],
|
|
61
|
+
{ [$style.delimiter]: delimiter },
|
|
62
|
+
]"
|
|
63
|
+
:style="{
|
|
64
|
+
'--label-padding' : !label.backgroundColor || label.backgroundColor === 'transparent' ? '0px': 'var(--sp-min) var(--sp-small)',
|
|
65
|
+
'--label-background-color': label.backgroundColor ?? 'transparent',
|
|
66
|
+
'--label-color' : label.color ?? 'var(--text-color)',
|
|
67
|
+
'--label-font-size' : label.fontSize ?? 'var(--fs-small)',
|
|
68
|
+
'--label-font-weight' : label.fontWeight ?? 'normal',
|
|
69
|
+
}"
|
|
70
|
+
:data-delimiter="delimiter"
|
|
71
|
+
>
|
|
72
|
+
{{ item }}
|
|
73
|
+
</li>
|
|
74
|
+
</ul>
|
|
75
|
+
</div>
|
|
76
|
+
</template>
|
|
77
|
+
|
|
78
|
+
<style lang="scss" module>
|
|
79
|
+
@use '../../../assets/scss/mixin' as *;
|
|
80
|
+
|
|
81
|
+
.metadata_list {
|
|
82
|
+
--icon-color: var(--disable-text-color);
|
|
83
|
+
display : flex;
|
|
84
|
+
align-items: center;
|
|
85
|
+
gap : var(--sp-small);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.icon {
|
|
89
|
+
flex: 0 0 var(--icon-size);
|
|
90
|
+
@include icon($size: var(--icon-size), $color: var(--icon-color));
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.list {
|
|
94
|
+
display : flex;
|
|
95
|
+
flex-wrap: wrap;
|
|
96
|
+
gap : var(--sp-small) var(--sp-medium);
|
|
97
|
+
|
|
98
|
+
.list_item {
|
|
99
|
+
line-height : 1;
|
|
100
|
+
background-color: var(--label-background-color);
|
|
101
|
+
padding : var(--label-padding);
|
|
102
|
+
color : var(--label-color);
|
|
103
|
+
font-size : var(--label-font-size);
|
|
104
|
+
font-weight : var(--label-font-weight);
|
|
105
|
+
|
|
106
|
+
&.rounded {
|
|
107
|
+
border-radius: calc(var(--bv) / 2);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
&.delimiter {
|
|
111
|
+
&:not(:last-child) {
|
|
112
|
+
&::after {
|
|
113
|
+
content: attr(data-delimiter);
|
|
114
|
+
margin-inline-start: var(--sp-medium);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
</style>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import ImageIcon from '../../../components/Icon/Image.vue'
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<template>
|
|
6
|
+
<div
|
|
7
|
+
:class="$style.no_image"
|
|
8
|
+
>
|
|
9
|
+
<ImageIcon />
|
|
10
|
+
<span>No Image</span>
|
|
11
|
+
</div>
|
|
12
|
+
</template>
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
<style lang="scss" module>
|
|
16
|
+
.no_image {
|
|
17
|
+
display : flex;
|
|
18
|
+
justify-content : center;
|
|
19
|
+
align-items : center;
|
|
20
|
+
gap : var(--sp-small);
|
|
21
|
+
width : 100%;
|
|
22
|
+
height : 100%;
|
|
23
|
+
background-color: var(--light-gray);
|
|
24
|
+
font-size : large;
|
|
25
|
+
|
|
26
|
+
> svg {
|
|
27
|
+
width : var(--sp-large);
|
|
28
|
+
height: var(--sp-large);
|
|
29
|
+
fill : var(--gray);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
> span {
|
|
33
|
+
color: var(--gray);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
</style>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { format, parseISO } from 'date-fns'
|
|
3
|
+
|
|
4
|
+
const props = withDefaults(defineProps<{
|
|
5
|
+
date: string
|
|
6
|
+
formatString?: string
|
|
7
|
+
color?: string
|
|
8
|
+
fontSize?: string
|
|
9
|
+
fontWeight?: string
|
|
10
|
+
}>(), {
|
|
11
|
+
formatString: 'yyyy/mm/dd',
|
|
12
|
+
color : 'var(--text-color)',
|
|
13
|
+
fontSize : 'small',
|
|
14
|
+
fontWeight : 'normal',
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
const parsedDate = parseISO(props.date)
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<template>
|
|
21
|
+
<time
|
|
22
|
+
:class="$style.posted_date"
|
|
23
|
+
:style="{
|
|
24
|
+
'--date-color' : color,
|
|
25
|
+
'--date-font-size' : fontSize,
|
|
26
|
+
'--date-font-weight': fontWeight,
|
|
27
|
+
}"
|
|
28
|
+
>
|
|
29
|
+
{{ format(parsedDate, formatString) }}
|
|
30
|
+
</time>
|
|
31
|
+
</template>
|
|
32
|
+
|
|
33
|
+
<style lang="scss" module>
|
|
34
|
+
.posted_date {
|
|
35
|
+
display : inline-flex;
|
|
36
|
+
align-items: flex-end;
|
|
37
|
+
color : var(--date-color);
|
|
38
|
+
font-size : var(--date-font-size);
|
|
39
|
+
font-weight: var(--date-font-weight);
|
|
40
|
+
}
|
|
41
|
+
</style>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type {
|
|
3
|
+
Article,
|
|
4
|
+
} from '../../../types'
|
|
5
|
+
import type { ComputedRef } from 'vue'
|
|
6
|
+
import { computed } from 'vue'
|
|
7
|
+
import MetadataList from '../../../components/ArticleList/Parts/MetadataList.vue'
|
|
8
|
+
import { returnTagList } from '../../../scripts/utils'
|
|
9
|
+
|
|
10
|
+
const props = defineProps<{
|
|
11
|
+
article: Article
|
|
12
|
+
icon?: {
|
|
13
|
+
color?: string
|
|
14
|
+
size?: 'small' | 'medium'
|
|
15
|
+
}
|
|
16
|
+
label?: {
|
|
17
|
+
backgroundColor?: string
|
|
18
|
+
color?: string
|
|
19
|
+
fontSize?: string
|
|
20
|
+
fontWeight?: string
|
|
21
|
+
shape?: | 'square' | 'rounded'
|
|
22
|
+
}
|
|
23
|
+
delimiter?: string
|
|
24
|
+
}>()
|
|
25
|
+
|
|
26
|
+
const tags: ComputedRef<string[]> = computed(() => returnTagList(props.article))
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
<template>
|
|
30
|
+
<MetadataList
|
|
31
|
+
v-if="tags.length"
|
|
32
|
+
:metadata="tags"
|
|
33
|
+
:icon="{
|
|
34
|
+
name : icon?.color ? 'TagIcon' : null,
|
|
35
|
+
color: icon?.color,
|
|
36
|
+
size : icon?.size,
|
|
37
|
+
}"
|
|
38
|
+
:label="label"
|
|
39
|
+
:delimiter="delimiter"
|
|
40
|
+
/>
|
|
41
|
+
</template>
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type {
|
|
3
|
+
Article,
|
|
4
|
+
} from '../../../types'
|
|
5
|
+
import { computed } from 'vue'
|
|
6
|
+
import NoImage from '../../../components/ArticleList/Parts/NoImage.vue'
|
|
7
|
+
|
|
8
|
+
const props = withDefaults(defineProps<{
|
|
9
|
+
article: Article
|
|
10
|
+
aspectRatio?: {
|
|
11
|
+
desktop?: string
|
|
12
|
+
tablet?: string
|
|
13
|
+
mobile?: string
|
|
14
|
+
}
|
|
15
|
+
}>(), {
|
|
16
|
+
aspectRatio: () => ({
|
|
17
|
+
desktop: '4/3',
|
|
18
|
+
tablet : '4/3',
|
|
19
|
+
mobile : '4/3',
|
|
20
|
+
}),
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
const thumbnailSrcset = computed(() => `${returnThumbnailSrc('full')} 1024w, ${returnThumbnailSrc('thumbnail')} 640w`)
|
|
24
|
+
const articleMedia = computed(() => props.article?.['_embedded']?.['wp:featuredmedia']?.[0] || {})
|
|
25
|
+
const returnThumbnailSrc = (type: 'full' | 'thumbnail') => articleMedia.value.media_details?.sizes?.[type].source_url ?? ''
|
|
26
|
+
</script>
|
|
27
|
+
|
|
28
|
+
<template>
|
|
29
|
+
<div
|
|
30
|
+
:style="{
|
|
31
|
+
'--desktop-aspect--ratio': aspectRatio.desktop,
|
|
32
|
+
'--tablet-aspect--ratio': aspectRatio.tablet,
|
|
33
|
+
'--mobile-aspect--ratio': aspectRatio.mobile,
|
|
34
|
+
}"
|
|
35
|
+
:class="$style.container"
|
|
36
|
+
>
|
|
37
|
+
<img
|
|
38
|
+
v-if="returnThumbnailSrc('full')"
|
|
39
|
+
:srcset="thumbnailSrcset"
|
|
40
|
+
sizes="(min-width: 640px) 50vw, 100vw"
|
|
41
|
+
:alt="articleMedia?.alt_text ?? '記事サムネイル'"
|
|
42
|
+
loading="lazy"
|
|
43
|
+
:class="$style.image"
|
|
44
|
+
>
|
|
45
|
+
<NoImage v-else />
|
|
46
|
+
</div>
|
|
47
|
+
</template>
|
|
48
|
+
|
|
49
|
+
<style lang="scss" module>
|
|
50
|
+
@use '../../../assets/scss/mixin' as *;
|
|
51
|
+
|
|
52
|
+
.container {
|
|
53
|
+
width: 100%;
|
|
54
|
+
|
|
55
|
+
@include media('mobile') {
|
|
56
|
+
aspect-ratio: var(--mobile-aspect--ratio);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
@include media('tablet') {
|
|
60
|
+
aspect-ratio: var(--tablet-aspect--ratio);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
@include media('desktop') {
|
|
64
|
+
aspect-ratio: var(--desktop-aspect--ratio);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
> img {
|
|
68
|
+
width : 100%;
|
|
69
|
+
height : 100%;
|
|
70
|
+
object-fit: cover;
|
|
71
|
+
|
|
72
|
+
@include media('mobile') {
|
|
73
|
+
aspect-ratio: var(--mobile-aspect--ratio);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
@include media('tablet') {
|
|
77
|
+
aspect-ratio: var(--tablet-aspect--ratio);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
@include media('desktop') {
|
|
81
|
+
aspect-ratio: var(--desktop-aspect--ratio);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
</style>
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { ButtonStyleForEachStatus } from '../types'
|
|
3
|
+
import { computed } from 'vue'
|
|
4
|
+
import LoadingSpinner from '../components/LoadingSpinner.vue'
|
|
5
|
+
import { COLOR } from '../const'
|
|
6
|
+
|
|
7
|
+
const props = defineProps<{
|
|
8
|
+
cssStyle?: ButtonStyleForEachStatus
|
|
9
|
+
duration?: number
|
|
10
|
+
isLoading?: boolean
|
|
11
|
+
isDisabled?: boolean
|
|
12
|
+
buttonType?: 'button' | 'submit' | 'reset'
|
|
13
|
+
}>()
|
|
14
|
+
|
|
15
|
+
const currentCssStyle = computed(() => {
|
|
16
|
+
const cssStyle = props.isDisabled ? props.cssStyle?.disabled : props.cssStyle?.default
|
|
17
|
+
|
|
18
|
+
return {
|
|
19
|
+
...{
|
|
20
|
+
textColor : COLOR.white,
|
|
21
|
+
backgroundColor: props.isDisabled ? COLOR.darkGray : COLOR.blue,
|
|
22
|
+
backgroundImage: 'none',
|
|
23
|
+
border : {
|
|
24
|
+
color : props.isDisabled ? COLOR.darkGray : COLOR.blue,
|
|
25
|
+
size : '1px',
|
|
26
|
+
radius: '.25rem',
|
|
27
|
+
},
|
|
28
|
+
boxShadow: '0 0 0 0 transparent',
|
|
29
|
+
},
|
|
30
|
+
...cssStyle,
|
|
31
|
+
}
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
const hoverStyle = props.cssStyle?.hover || {}
|
|
35
|
+
</script>
|
|
36
|
+
|
|
37
|
+
<template>
|
|
38
|
+
<button
|
|
39
|
+
:class="[
|
|
40
|
+
$style.button,
|
|
41
|
+
{ [$style.loading] : isLoading },
|
|
42
|
+
]"
|
|
43
|
+
:style="{
|
|
44
|
+
'--text-color': currentCssStyle?.textColor,
|
|
45
|
+
'--background-color': currentCssStyle?.backgroundColor,
|
|
46
|
+
'--background-image': currentCssStyle?.backgroundImage,
|
|
47
|
+
'--border-color': currentCssStyle?.border?.color,
|
|
48
|
+
'--border-size': currentCssStyle?.border?.size,
|
|
49
|
+
'--radius-size': currentCssStyle?.border?.radius,
|
|
50
|
+
'--box-shadow': currentCssStyle?.boxShadow,
|
|
51
|
+
'--hover-text-color': hoverStyle?.textColor || currentCssStyle?.textColor,
|
|
52
|
+
'--hover-background-color': hoverStyle?.backgroundColor || currentCssStyle?.backgroundColor && `${currentCssStyle?.backgroundColor}cc`,
|
|
53
|
+
'--hover-background-image': hoverStyle?.backgroundImage || currentCssStyle?.backgroundImage,
|
|
54
|
+
'--hover-border-color': hoverStyle?.border?.color || currentCssStyle?.border?.color,
|
|
55
|
+
'--hover-border-size': hoverStyle?.border?.size || currentCssStyle?.border?.size,
|
|
56
|
+
'--hover-radius-size': hoverStyle?.border?.radius || currentCssStyle?.border?.radius,
|
|
57
|
+
'--hover-box-shadow': hoverStyle?.boxShadow || currentCssStyle?.boxShadow,
|
|
58
|
+
'--duration': `${duration || .3}s`,
|
|
59
|
+
}"
|
|
60
|
+
:type="buttonType || 'button'"
|
|
61
|
+
:disabled="isDisabled || isLoading"
|
|
62
|
+
>
|
|
63
|
+
<div
|
|
64
|
+
v-show="isLoading"
|
|
65
|
+
:class="$style.loading_animation"
|
|
66
|
+
>
|
|
67
|
+
<slot
|
|
68
|
+
v-if="$slots.loading"
|
|
69
|
+
name="loading"
|
|
70
|
+
/>
|
|
71
|
+
<LoadingSpinner v-else />
|
|
72
|
+
</div>
|
|
73
|
+
<div>
|
|
74
|
+
<slot />
|
|
75
|
+
</div>
|
|
76
|
+
</button>
|
|
77
|
+
</template>
|
|
78
|
+
|
|
79
|
+
<style lang="scss" module>
|
|
80
|
+
:is(.button) {
|
|
81
|
+
display : inline-flex;
|
|
82
|
+
justify-content : center;
|
|
83
|
+
align-items : center;
|
|
84
|
+
inline-size : max-content;
|
|
85
|
+
padding : 1rem 2rem;
|
|
86
|
+
background-color: var(--background-color);
|
|
87
|
+
box-shadow :
|
|
88
|
+
0 0 0 var(--border-size) var(--border-color) inset,
|
|
89
|
+
var(--box-shadow);
|
|
90
|
+
border : none;
|
|
91
|
+
border-radius : var(--radius-size);
|
|
92
|
+
color : var(--text-color);
|
|
93
|
+
line-height : 1;
|
|
94
|
+
transition : all var(--duration);
|
|
95
|
+
position : relative;
|
|
96
|
+
cursor : pointer;
|
|
97
|
+
|
|
98
|
+
@media (hover: hover) {
|
|
99
|
+
&:where(:any-link, :enabled, summary):hover {
|
|
100
|
+
background-color: var(--hover-background-color);
|
|
101
|
+
box-shadow :
|
|
102
|
+
0 0 0 var(--hover-border-size) var(--hover-border-color) inset,
|
|
103
|
+
var(--hover-box-shadow);
|
|
104
|
+
border-radius : var(--hover-radius-size);
|
|
105
|
+
color : var(--hover-text-color);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
&.loading,
|
|
110
|
+
&:disabled {
|
|
111
|
+
pointer-events: none !important;
|
|
112
|
+
|
|
113
|
+
&::before {
|
|
114
|
+
content : '';
|
|
115
|
+
position : absolute;
|
|
116
|
+
inset : 0;
|
|
117
|
+
pointer-events: all;
|
|
118
|
+
cursor : not-allowed !important;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
&.loading {
|
|
123
|
+
> *:not(:is(.loading_animation)) {
|
|
124
|
+
visibility: hidden;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
:is(.loading_animation) {
|
|
130
|
+
max-block-size: calc(100% - 1.5rem);
|
|
131
|
+
color : currentColor;
|
|
132
|
+
fill : currentColor;
|
|
133
|
+
position : absolute;
|
|
134
|
+
margin : auto;
|
|
135
|
+
inset : 0;
|
|
136
|
+
|
|
137
|
+
* {
|
|
138
|
+
max-block-size: 100%;
|
|
139
|
+
color : currentColor;
|
|
140
|
+
fill : currentColor;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
</style>
|