Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

created Bluerpints Cards Carusel #1214

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions components/home/Testimonials.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,13 @@
import TestimonialsItem from './TestimonialsItem.vue';
import ArrowLeft from "vue-material-design-icons/ArrowLeft.vue";
import ArrowRight from "vue-material-design-icons/ArrowRight.vue";
import 'vue3-carousel/dist/carousel.css'
import { Carousel, Slide, Pagination, Navigation } from 'vue3-carousel'

export default {
components: {
Section,
TestimonialsItem,
ArrowLeft,
ArrowRight,
Carousel,
Slide,
Pagination,
Navigation,
},
data() {
return {
Expand Down
168 changes: 168 additions & 0 deletions components/layout/BluerpintsCardsCarusel.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
<template>
<div class="container">
<div class="title mb-3">
<p>Related Blueprints</p>
</div>
<div class="mt-3">
<Carousel v-bind="settings" :breakpoints="breakpoints">
<Slide v-for="blueprint in blueprints" :key="blueprint.id" >
<div class="carousel--item">
<BlueprintsListCard :blueprint="blueprint" :tags="tags"/>
</div>
</Slide>
<template #addons>
<navigation>
<template #next>
<div class="carousel-control carousel-control-next">
<ChevronRight />
</div>
</template>
<template #prev>
<div class="carousel-control carousel-control-prev">
<ChevronLeft />
</div>
</template>
</navigation>
</template>
</Carousel>
</div>
</div>
</template>
<script setup>
const config = useRuntimeConfig();
const blueprints = ref([])
const props = defineProps({
query: {
type: String,
required: true
},
})

const { data: blueprintsData } = await useAsyncData('blueprints', () => {
return $fetch(`${config.public.apiUrl}/blueprints?type=${props.query}`)
});

const {data: tags} = await useAsyncData('blueprints-tags', () => {
return $fetch(`${config.public.apiUrl}/blueprints/tags`)
})
if(blueprintsData.value) {
blueprints.value = blueprintsData.value.results
}
</script>

<script>
import Section from '../layout/Section.vue';
import ChevronRight from "vue-material-design-icons/ChevronRight.vue";
import ChevronLeft from "vue-material-design-icons/ChevronLeft.vue";

export default {
components: {
ChevronLeft,
ChevronRight,
Section,
},
data() {
return {
settings: {
itemsToShow: 1,
snapAlign: 'center',
},
breakpoints: {
900: {
itemsToShow: 2,
snapAlign: 'start',
},
990: {
itemsToShow: 1,
snapAlign: 'start',
},
1024: {
itemsToShow: 1.5,
snapAlign: 'start',
},
1300: {
itemsToShow: 2,
snapAlign: 'start',
},
1500: {
itemsToShow: 2.4,
snapAlign: 'start',
},
},
};
},
}
</script>

<style lang="scss" scoped>
@import "../../assets/styles/variable";
.container {
border-top: $block-border;
padding: 3rem 0;
margin-top: 5rem;
.title {
padding: 0 $spacer;
border-left: 5px solid $purple-36;
p {
font-size: calc($font-size-base * 2.25);
font-weight: 600;
margin: 0;
}
}
:deep(.card) {
text-align: left;
min-width: calc($spacer * 17.7);
margin-right: $spacer;
min-height: calc($spacer * 19.1);
}
.carousel-control-prev, .carousel-control-next {
width: fit-content;
background-color: $primary-1;
border-radius: 50%;
width: 40px;
height: 40px;
opacity: 1;
:deep(.material-design-icon > .material-design-icon__svg) {
bottom: 0;
color: $white;
}
}

.carousel--item {
width: 100%;
height: 100%;
}

:deep(.carousel) {
.carousel__viewport {
position: relative;
&:before {
content: "";
position: absolute;
right: -142px;
width: 16rem;
top: -18px;
background-color: #111113;
height: 100%;
z-index: 1;
filter: blur(47px);
}
}
.carousel__prev {
left: calc($spacer * 3.6);
}
.carousel__next {
right: calc($spacer * 3.6);
}
.carousel__next,
.carousel__prev {
z-index: 2 !important;
opacity: 1;
}
.carousel__next--disabled,
.carousel__prev--disabled {
display: none;
}
}
}
</style>
8 changes: 6 additions & 2 deletions components/layout/Container.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
data-bs-target="#nav-toc"
/>
<PrevNext v-if="prevNext" :navigation="navigation" />
<LayoutBluerpintsCardsCarusel :query="queryType" />
</div>
</ContentRenderer>
</article>
Expand All @@ -52,6 +53,7 @@
const route = useRoute()
const slug = computed(() => `/${props.type}/${route.params.slug instanceof Array ? route.params.slug.join('/') : route.params.slug}`);
let page;
let queryType;

const fetchNavigation = async () => {
let navigationFetch;
Expand Down Expand Up @@ -95,9 +97,11 @@
const parts = slug.value.split('/');
let pageUrl;
if (parts.length > 3) {
pageUrl = `/api/plugins?page=${parts[parts.length - 1].replace(/.md$/, "")}&type=definitions`
queryType = parts[parts.length - 1]
pageUrl = `/api/plugins?page=${queryType.replace(/.md$/, "")}&type=definitions`
} else {
pageUrl = `/api/plugins?page=${parts[2]}&type=plugin`
queryType = parts[2];
pageUrl = `/api/plugins?page=${queryType}&type=plugin`
}

const {data: pluginInformation} = await useAsyncData(`Container-${hash(pageUrl)}`, () => {
Expand Down