Created
May 19, 2022 18:48
-
-
Save JeffreyWay/26a34c6da641ae96a68ba43106f9aafe to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Assignment from "./Assignment.js"; | |
import AssignmentTags from "./AssignmentTags.js"; | |
import Panel from "./Panel.js"; | |
export default { | |
components: { Assignment, AssignmentTags, Panel }, | |
template: ` | |
<Panel v-show="assignments.length" class="w-60"> | |
<div class="flex justify-between items-start"> | |
<h2 class="font-bold mb-2"> | |
{{ title }} | |
<span>({{ assignments.length }})</span> | |
</h2> | |
<button v-show="canToggle" @click="$emit('toggle')">×</button> | |
</div> | |
<assignment-tags | |
v-model:currentTag="currentTag" | |
:initial-tags="assignments.map(a => a.tag)" | |
></assignment-tags> | |
<ul class="border border-gray-600 divide-y divide-gray-600 mt-6"> | |
<assignment | |
v-for="assignment in filteredAssignments" | |
:key="assignment.id" | |
:assignment="assignment" | |
></assignment> | |
</ul> | |
<slot></slot> | |
</Panel> | |
`, | |
props: { | |
assignments: Array, | |
title: String, | |
canToggle: { type: Boolean, default: false } | |
}, | |
data() { | |
return { | |
currentTag: 'all', | |
}; | |
}, | |
computed: { | |
filteredAssignments() { | |
if (this.currentTag === 'all') { | |
return this.assignments; | |
} | |
return this.assignments.filter(a => a.tag === this.currentTag); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default { | |
template: ` | |
<div :class="{ | |
'p-4 border rounded-lg': true, | |
'bg-white border-gray-300 text-black' : theme == 'light', | |
'bg-gray-700 border-gray-600 text-white' : theme == 'dark', | |
}"> | |
<h2 v-if="$slots.heading" class="font-bold mb-2"> | |
<slot name="heading" /> | |
</h2> | |
<slot /> | |
<footer v-if="$slots.footer" class="border-gray-600 border-t mt-4 pt-4 text-sm"> | |
<slot name="footer"></slot> | |
</footer> | |
</div> | |
`, | |
props: { | |
theme: { type: String, default: 'dark' } | |
} | |
} |
Just add w-full
:
<div class="border border-gray-600 text-black flex">
<input v-model="newLesson" type="text" placeholder="Add a new lesson" class="p-2 w-full">
<button type="submit" class="bg-white p-2 border-l">Add</button>
</div>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ok, that's worked for me. Thank you