-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use dialog instead, rather than creating route
- Loading branch information
1 parent
1903495
commit d2ceaf7
Showing
15 changed files
with
265 additions
and
33 deletions.
There are no files selected for viewing
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
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
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
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
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
<template> | ||
<div> | ||
<div id="social-wall"> | ||
<slot /> | ||
</div> | ||
</template> | ||
|
||
<script setup lang="ts"></script> | ||
|
||
<style> | ||
@import url('@/style.css'); | ||
</style> |
47 changes: 47 additions & 0 deletions
47
packages/components/src/components/social-wall/SocialWallDialog.vue
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<template> | ||
<teleport to="body"> | ||
<div v-if="isOpen" class="modal-overlay"> | ||
<div class="modal-content"> | ||
<slot></slot> | ||
<button @click="close">Close</button> | ||
</div> | ||
</div> | ||
</teleport> | ||
</template> | ||
|
||
<script setup> | ||
import { defineProps, defineEmits } from 'vue' | ||
defineProps({ | ||
isOpen: { | ||
type: Boolean, | ||
required: true, | ||
}, | ||
}) | ||
const emit = defineEmits(['update:isOpen']) | ||
function close() { | ||
emit('update:isOpen', false) | ||
} | ||
</script> | ||
|
||
<style> | ||
.modal-overlay { | ||
position: fixed; | ||
top: 0; | ||
left: 0; | ||
width: 100%; | ||
height: 100%; | ||
background: rgba(0, 0, 0, 0.5); | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
} | ||
.modal-content { | ||
background: white; | ||
padding: 20px; | ||
border-radius: 5px; | ||
} | ||
</style> |
84 changes: 83 additions & 1 deletion
84
packages/components/src/components/social-wall/SocialWallResults.vue
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,85 @@ | ||
<template> | ||
<div class="bg-red p-10">Results</div> | ||
<div class="max-w-md mx-auto overflow-y-auto h-screen"> | ||
<div v-for="(video, index) in videos" :key="index" class="bg-white rounded-lg shadow-md overflow-hidden" @click="openModal(video)"> | ||
<v-lazy-image | ||
:src="video.thumbnail" | ||
src-placeholder="https://cdn-images-1.medium.com/max/80/1*xjGrvQSXvj72W4zD6IWzfg.jpeg" | ||
:alt="video.title" | ||
class="w-full h-48 object-cover" | ||
/> | ||
<div class="p-4"> | ||
<h2 class="text-lg font-semibold">{{ video.title }}</h2> | ||
<p class="text-gray-600 text-sm">{{ video.description }}</p> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<SocialWallDialog :is-open="isModalOpen" @update:isOpen="isModalOpen = $event" /> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { ref } from 'vue' | ||
import VLazyImage from 'v-lazy-image' | ||
import SocialWallDialog from '@components/social-wall/SocialWallDialog.vue' | ||
const open = ref(false) | ||
const isModalOpen = ref(false) | ||
function openModal(video: any) { | ||
console.log('video', video) | ||
isModalOpen.value = true | ||
} | ||
// Sample data for videos | ||
const videos = [ | ||
{ | ||
title: 'Vue.js Basics', | ||
description: 'Learn the basics of Vue.js in this introductory video.', | ||
thumbnail: 'https://cdn-images-1.medium.com/max/1600/1*xjGrvQSXvj72W4zD6IWzfg.jpeg', | ||
}, | ||
{ | ||
title: 'Advanced Vue Techniques', | ||
description: 'Explore advanced techniques in Vue.js development.', | ||
thumbnail: 'https://cdn-images-1.medium.com/max/1600/1*xjGrvQSXvj72W4zD6IWzfg.jpeg', | ||
}, | ||
{ | ||
title: 'Building a Vue App', | ||
description: 'Step-by-step guide to building a Vue.js application.', | ||
thumbnail: 'https://cdn-images-1.medium.com/max/1600/1*xjGrvQSXvj72W4zD6IWzfg.jpeg', | ||
}, | ||
{ | ||
title: 'State Management with Vuex', | ||
description: 'Manage state in your Vue.js apps using Vuex.', | ||
thumbnail: 'https://cdn-images-1.medium.com/max/1600/1*xjGrvQSXvj72W4zD6IWzfg.jpeg', | ||
}, | ||
{ | ||
title: 'Vue Router for Navigation', | ||
description: 'Implement navigation in your Vue.js apps with Vue Router.', | ||
thumbnail: 'https://cdn-images-1.medium.com/max/1600/1*xjGrvQSXvj72W4zD6IWzfg.jpeg', | ||
}, | ||
{ | ||
title: 'Deploying Vue Apps', | ||
description: 'Learn how to deploy your Vue.js applications.', | ||
thumbnail: 'https://cdn-images-1.medium.com/max/1600/1*xjGrvQSXvj72W4zD6IWzfg.jpeg', | ||
}, | ||
] | ||
const items = ref( | ||
videos.map((v, idx) => ({ | ||
...v, | ||
id: idx, | ||
})) | ||
) | ||
</script> | ||
|
||
<style> | ||
@import url('@/style.css'); | ||
.v-lazy-image { | ||
filter: blur(10px); | ||
transition: filter 0.7s; | ||
} | ||
.v-lazy-image-loaded { | ||
filter: blur(0); | ||
} | ||
</style> |
54 changes: 53 additions & 1 deletion
54
packages/components/src/components/social-wall/SocialWallSearch.vue
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,55 @@ | ||
<template> | ||
<div class="bg-red p-10">Search</div> | ||
<div class="relative w-full max-w-md mx-auto"> | ||
<input | ||
v-model="query" | ||
type="text" | ||
class="w-full p-2 border border-gray-300 rounded" | ||
placeholder="Search..." | ||
@input="onInput" | ||
@focus="showSuggestions = true" | ||
@blur="hideSuggestions" | ||
/> | ||
<ul v-if="showSuggestions && filteredSuggestions.length" class="absolute z-10 w-full bg-white border border-gray-300 rounded shadow-lg"> | ||
<li v-for="(suggestion, index) in filteredSuggestions" :key="index" class="p-2 hover:bg-gray-100 cursor-pointer" @mousedown.prevent="selectSuggestion(suggestion)"> | ||
{{ suggestion }} | ||
</li> | ||
</ul> | ||
</div> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { ref, computed } from 'vue' | ||
import { RouterView } from 'vue-router' | ||
const query = ref('') | ||
const showSuggestions = ref(false) | ||
const suggestions = ref<string[]>(['Apple', 'Banana', 'Cherry', 'Date', 'Elderberry', 'Fig', 'Grape', 'Honeydew']) | ||
const filteredSuggestions = computed(() => { | ||
if (!query.value) { | ||
return [] | ||
} | ||
const lowerCaseQuery = query.value.toLowerCase() | ||
return suggestions.value.filter((suggestion) => suggestion.toLowerCase().includes(lowerCaseQuery)) | ||
}) | ||
const onInput = () => { | ||
showSuggestions.value = true | ||
} | ||
const hideSuggestions = () => { | ||
setTimeout(() => { | ||
showSuggestions.value = false | ||
}, 100) | ||
} | ||
const selectSuggestion = (suggestion: string) => { | ||
query.value = suggestion | ||
showSuggestions.value = false | ||
} | ||
</script> | ||
|
||
<style> | ||
@import url('@/style.css'); | ||
</style> |
38 changes: 36 additions & 2 deletions
38
packages/components/src/components/social-wall/SocialWallTags.vue
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,38 @@ | ||
<template> | ||
<div class="bg-blue p-10">Tags</div> | ||
<div class="w-full max-w-md mx-auto"> | ||
<div class="flex flex-wrap items-center"> | ||
<button | ||
v-for="(tag, index) in tags" | ||
:key="index" | ||
:class="['m-1 px-3 py-1 rounded-full text-sm font-medium', selectedTags.includes(tag) ? 'bg-blue-500 text-white' : 'bg-gray-200 text-gray-800 hover:bg-gray-300']" | ||
@click="toggleTag(tag)" | ||
> | ||
{{ tag }} | ||
</button> | ||
</div> | ||
</div> | ||
</template> | ||
<script setup lang="ts"></script> | ||
|
||
<script setup lang="ts"> | ||
import { createApp, h, ref } from 'vue' | ||
// Sample data for tags | ||
const tags = ref<string[]>(['JavaScript', 'Vue.js', 'React', 'Angular', 'TypeScript', 'Node.js', 'CSS', 'HTML']) | ||
// Reactive state to track selected tags | ||
const selectedTags = ref<string[]>([]) | ||
// Method to toggle tag selection | ||
const toggleTag = (tag: string) => { | ||
const index = selectedTags.value.indexOf(tag) | ||
if (index === -1) { | ||
selectedTags.value.push(tag) | ||
} else { | ||
selectedTags.value.splice(index, 1) | ||
} | ||
} | ||
</script> | ||
|
||
<style> | ||
@import url('@/style.css'); | ||
</style> |
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
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
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
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
Oops, something went wrong.