Skip to content

Commit e1179b3

Browse files
committed
ContentCardの統合
1 parent 32fbb12 commit e1179b3

File tree

4 files changed

+72
-153
lines changed

4 files changed

+72
-153
lines changed

src/components/ContentCard.vue

Lines changed: 67 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,69 @@
11
<template>
2-
<v-card class="ContentCard elevation-4">
3-
<v-card-actions class="ContentCard-Actions">
4-
<subject-tag
5-
v-for="(item, idx) in subjects"
6-
:key="idx"
7-
class="ContentCard-SubjectTag"
8-
:name="item.name || '教科名'"
9-
:icon="item.icon || ''"
10-
:icon-color="item.iconColor || 'white'"
11-
:background-color="item.backgroundColor || '#A5D8FF'"
2+
<div class="ContentCard-Outer">
3+
<v-card class="ContentCard elevation-4">
4+
<v-card-actions class="ContentCard-Actions">
5+
<subject-tag
6+
class="ContentCard-SubjectTag"
7+
:name="lesson.subject.name || '教科名'"
8+
:icon="lesson.subject.icon || ''"
9+
:icon-color="lesson.subject.iconColor || 'white'"
10+
:background-color="lesson.subject.color || '#A5D8FF'"
11+
/>
12+
<subject-tag
13+
v-if="lesson.videos.length >= 1"
14+
class="ContentCard-SubjectTag"
15+
:name="'動画'"
16+
:icon="'mdi-video'"
17+
:icon-color="'#424242'"
18+
:background-color="'#E0E0E0'"
19+
/>
20+
</v-card-actions>
21+
<v-card-title>
22+
<h2 class="ContentCard-Title">{{ lesson.title }}</h2>
23+
</v-card-title>
24+
<v-card-text>
25+
<p class="ContentCard-Description">{{ lesson.description }}</p>
26+
</v-card-text>
27+
</v-card>
28+
<div v-if="editable" class="ContentCard-Button-Outer">
29+
<content-card-editor-button
30+
class="ContentCard-Button"
31+
icon-name="mdi-eye-off"
32+
@click="$emit('toggleHidden')"
1233
/>
13-
<subject-tag
14-
v-if="hasVideo"
15-
class="ContentCard-SubjectTag"
16-
:name="'動画'"
17-
:icon="'mdi-video'"
18-
:icon-color="'#424242'"
19-
:background-color="'#E0E0E0'"
34+
<content-card-editor-button
35+
class="ContentCard-Button"
36+
icon-name="mdi-pencil"
37+
@click="$emit('clickEditButton')"
2038
/>
21-
</v-card-actions>
22-
<v-card-title>
23-
<h2 class="ContentCard-Title">{{ title }}</h2>
24-
</v-card-title>
25-
<v-card-text>
26-
<p class="ContentCard-Description">{{ description }}</p>
27-
</v-card-text>
28-
</v-card>
39+
<!--
40+
<content-card-editor-button
41+
class="ContentCard-Button"
42+
icon-name="mdi-file-multiple"
43+
/>
44+
-->
45+
</div>
46+
</div>
2947
</template>
3048

3149
<script lang="ts">
3250
import Vue from 'vue'
3351
import SubjectTag from '@/components/SubjectTag.vue'
52+
import ContentCardEditorButton from '@/components/ContentCardEditorButton.vue'
53+
import { classData } from '~/types/store/classData'
3454
3555
export default Vue.extend({
36-
components: { SubjectTag },
56+
components: {
57+
SubjectTag,
58+
ContentCardEditorButton
59+
},
3760
props: {
38-
subjects: {
39-
type: Array,
40-
default: () => []
41-
},
42-
title: {
43-
type: String,
44-
default: ''
45-
},
46-
description: {
47-
type: String,
48-
default: ''
61+
lesson: {
62+
type: Object as () => classData.Lesson,
63+
required: true,
64+
default: () => {}
4965
},
50-
hasVideo: {
66+
editable: {
5167
type: Boolean,
5268
default: false
5369
}
@@ -56,7 +72,20 @@ export default Vue.extend({
5672
</script>
5773

5874
<style scoped lang="scss">
75+
.ContentCard-Outer {
76+
display: flex;
77+
}
78+
.ContentCard-Button-Outer {
79+
display: flex;
80+
flex-direction: column;
81+
flex: 0 1 auto;
82+
margin-left: 12px;
83+
.ContentCard-Button {
84+
margin-bottom: 12px;
85+
}
86+
}
5987
.ContentCard {
88+
flex: 1 1 auto;
6089
color: $color-gray;
6190
border-radius: 14px !important;
6291
.ContentCard-Actions {

src/components/ContentCardEditable.vue

Lines changed: 0 additions & 104 deletions
This file was deleted.

src/components/PeriodCard.vue

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,7 @@
1818
cols="12"
1919
md="6"
2020
>
21-
<content-card
22-
:description="item.description"
23-
:title="item.title"
24-
:subjects="[
25-
{ name: item.subject.name, backgroundColor: item.subject.color }
26-
]"
27-
:has-video="item.videos.length !== 0"
28-
/>
21+
<content-card :lesson="item" />
2922
</v-col>
3023
</v-row>
3124
</div>

src/components/PeriodCardEditable.vue

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@
1818
cols="12"
1919
md="6"
2020
>
21-
<content-card-editable
21+
<content-card
2222
:lesson="item"
23+
:editable="true"
2324
@clickEditButton="$emit('clickEditButton', item)"
2425
/>
2526
</v-col>
@@ -30,11 +31,11 @@
3031
<script lang="ts">
3132
import Vue from 'vue'
3233
import dayjs from 'dayjs'
33-
import ContentCardEditable from '@/components/ContentCardEditable.vue'
34+
import ContentCard from '~/components/ContentCard.vue'
3435
import { classData } from '~/types/store/classData'
3536
3637
export default Vue.extend({
37-
components: { ContentCardEditable },
38+
components: { ContentCard },
3839
props: {
3940
classData: {
4041
type: Object as () => classData.Lesson,

0 commit comments

Comments
 (0)