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

Improved styling and functionality of application cards display #3003

Merged
Merged
Show file tree
Hide file tree
Changes from 2 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<template>
<v-row>
<v-col v-for="card in cards" :key="card.title" cols="12" sm="12" md="12" lg="6">
<router-link :to="card.route">
<v-hover>
<template v-slot:default="{ isHovering, props }">
<v-card
class="pa-3 pt-6"
:height="isMobile && tallestCard > 200 ? tallestCard + 15 : 200"
v-bind="props"
:class="isHovering ? 'card-opacity' : undefined"
>
<v-img
class="d-inline-block ml-3 mb-2"
width="35"
:src="baseURL + 'images/icons/' + card.icon"
:alt="card.title"
:style="{
filter: `brightness(${$vuetify.theme.global.name === 'light' ? 0.2 : 1})`,
lineHeight: 1,
}"
/>
<v-card-title class="d-inline-block">
{{ card.title }}
<v-chip v-for="tag in card.tags" :key="tag" class="ml-2 pulse-animation">
{{ tag }}
</v-chip>
<v-chip v-if="card.flare" class="ml-2 pulse-animation"> Community </v-chip>
</v-card-title>
Mahmoud-Emad marked this conversation as resolved.
Show resolved Hide resolved
<v-card-text class="mt-2"> {{ card.excerpt }} </v-card-text>
</v-card>
</template></v-hover
>
</router-link>
</v-col>
</v-row>
</template>

<script lang="ts">
import { defineComponent, type PropType, ref } from "vue";
import { useDisplay } from "vuetify";

import type { ApplicationCard } from "@/utils/types";

export default defineComponent({
name: "ApplicationCards",
props: {
cards: {
type: Object as PropType<ApplicationCard[]>,
required: true,
},
},
setup(props) {
const baseURL = import.meta.env.BASE_URL;
const tallestCard = ref(0);
const isMobile = useDisplay().mobile;

props.cards.forEach(card => {
if (card.excerpt.length > tallestCard.value) {
tallestCard.value = card.excerpt.length;
}
});

return {
baseURL,
tallestCard,
isMobile,
};
},
});
</script>

<style scoped>
a {
text-decoration: none !important;
}

.card-opacity {
background-color: rgba(125, 227, 200, 0.12);
}
</style>
9 changes: 9 additions & 0 deletions packages/playground/src/utils/types.ts
Mahmoud-Emad marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,12 @@ export interface IPublicConfig {
gw6?: string;
domain?: string;
}

export interface ApplicationCard {
title: string;
excerpt: string;
icon: string;
route: string;
flare?: string;
tags?: string[];
}
55 changes: 7 additions & 48 deletions packages/playground/src/views/orchestrators_view.vue
Original file line number Diff line number Diff line change
@@ -1,49 +1,20 @@
<template>
<view-layout>
<v-row>
<v-col v-for="card in cards" :key="card.title">
<router-link :to="card.route">
<v-hover>
<template v-slot:default="{ isHovering, props }">
<v-card class="pa-3 pt-6" height="200" v-bind="props" :class="isHovering ? 'card-opacity' : undefined">
<v-img
class="d-inline-block ml-3 mb-2"
width="35"
:src="baseURL + 'images/icons/' + card.icon"
:alt="card.title"
:style="{
filter: `brightness(${$vuetify.theme.global.name === 'light' ? 0.2 : 1})`,
lineHeight: 1,
}"
/>
<v-card-title class="d-inline-block">
{{ card.title }}
<v-chip v-if="card.flare" class="ml-2 pulse-animation"> Community </v-chip>
</v-card-title>
<v-card-text class="mt-2"> {{ card.excerpt }} </v-card-text>
</v-card>
</template></v-hover
>
</router-link>
</v-col>
</v-row>
<ApplicationCards :cards="cards" />
</view-layout>
</template>
<script lang="ts">
import ApplicationCards from "@/components/applications/ApplicationCards.vue";
import { DashboardRoutes } from "@/router/routes";

interface Card {
title: string;
excerpt: string;
icon: string;
route: string;
flare?: string;
}
import type { ApplicationCard } from "@/utils/types";

export default {
name: "Orchestrators View",
components: {
ApplicationCards,
},
setup() {
const cards: Card[] = [
const cards: ApplicationCard[] = [
{
title: "Kubernetes",
excerpt:
Expand All @@ -59,22 +30,10 @@ export default {
route: DashboardRoutes.Orchestrators.CapRover,
},
];
const baseURL = import.meta.env.BASE_URL;

return {
cards,
baseURL,
};
},
};
</script>

<style scoped>
a {
text-decoration: none !important;
}

.card-opacity {
background-color: rgba(125, 227, 200, 0.12);
}
</style>
59 changes: 8 additions & 51 deletions packages/playground/src/views/solutions_view.vue
Original file line number Diff line number Diff line change
@@ -1,56 +1,25 @@
<template>
<view-layout>
<v-text-field label="Search Applications" v-model="searchItem" class="mb-5" clearable></v-text-field>
<v-row>
<v-col sm="12" md="6" lg="4" v-for="card in filteredCards" :key="card.title">
<router-link :to="card.route">
<v-hover>
<template v-slot:default="{ isHovering, props }">
<v-card class="pa-3 pt-6" height="100%" v-bind="props" :class="isHovering ? 'card-opacity' : undefined">
<v-img
class="d-inline-block ml-3 mb-2"
width="35"
:src="baseURL + 'images/icons/' + card.icon"
:alt="card.title"
:style="{
filter: `brightness(${$vuetify.theme.global.name === 'light' ? 0.2 : 1})`,
lineHeight: 1,
}"
/>
<v-card-title class="d-inline-block">
{{ card.title }}
<v-chip v-for="tag in card.tags" :key="tag" class="ml-2 pulse-animation">
{{ tag }}
</v-chip>
</v-card-title>
<v-card-text class="mt-2"> {{ card.excerpt }} </v-card-text>
</v-card>
</template></v-hover
>
</router-link>
</v-col>
<p v-if="filteredCards.length === 0" class="mx-3 mb-3">No solution was found with the provided search query.</p>
</v-row>
<ApplicationCards :cards="filteredCards" />
<p v-if="filteredCards.length === 0" class="mx-3 mb-3">No solution was found with the provided search query.</p>
</view-layout>
</template>

<script lang="ts">
import { computed, ref } from "vue";

import ApplicationCards from "@/components/applications/ApplicationCards.vue";
import { DashboardRoutes } from "@/router/routes";

interface Card {
title: string;
excerpt: string;
icon: string;
route: string;
tags?: string[];
}
import type { ApplicationCard } from "@/utils/types";

export default {
name: "SolutionsView",
components: {
ApplicationCards,
},
setup() {
let cards: Card[] = [
let cards: ApplicationCard[] = [
{
title: "Nostr",
excerpt:
Expand Down Expand Up @@ -167,28 +136,16 @@ export default {
];
cards = cards.sort((a, b) => a.title.localeCompare(b.title));

const baseURL = import.meta.env.BASE_URL;
const searchItem = ref("");
const filteredCards = computed(() =>
cards.filter(n => n.title.toLocaleLowerCase().includes(searchItem.value.toLocaleLowerCase())),
);

return {
cards,
baseURL,
searchItem,
filteredCards,
};
},
};
</script>

<style scoped>
a {
text-decoration: none !important;
}

.card-opacity {
background-color: rgba(125, 227, 200, 0.12);
}
</style>
56 changes: 8 additions & 48 deletions packages/playground/src/views/vms_view.vue
Original file line number Diff line number Diff line change
@@ -1,49 +1,21 @@
<template>
<view-layout>
<v-row>
<v-col v-for="card in cards" :key="card.title">
<router-link :to="card.route">
<v-hover>
<template v-slot:default="{ isHovering, props }">
<v-card class="pa-3 pt-6" height="200" v-bind="props" :class="isHovering ? 'card-opacity' : undefined">
<v-img
class="d-inline-block ml-3 mb-2"
width="35"
:src="baseURL + 'images/icons/' + card.icon"
:alt="card.title"
:style="{
filter: `brightness(${$vuetify.theme.global.name === 'light' ? 0.2 : 1})`,
lineHeight: 1,
}"
/>
<v-card-title class="d-inline-block">
{{ card.title }}
<v-chip v-if="card.flare" class="ml-2 pulse-animation"> Community </v-chip>
</v-card-title>
<v-card-text class="mt-2"> {{ card.excerpt }} </v-card-text>
</v-card>
</template></v-hover
>
</router-link>
</v-col>
</v-row>
<ApplicationCards :cards="cards" />
</view-layout>
</template>
<script lang="ts">
import ApplicationCards from "@/components/applications/ApplicationCards.vue";
import { DashboardRoutes } from "@/router/routes";

interface Card {
title: string;
excerpt: string;
icon: string;
route: string;
flare?: string;
}
import type { ApplicationCard } from "@/utils/types";

export default {
name: "VmsView",
components: {
ApplicationCards,
},

setup() {
const cards: Card[] = [
const cards: ApplicationCard[] = [
{
title: "Full Virtual Machine",
excerpt:
Expand All @@ -59,22 +31,10 @@ export default {
route: DashboardRoutes.VirtualMachines.MicroVirtualMachine,
},
];
const baseURL = import.meta.env.BASE_URL;

return {
cards,
baseURL,
};
},
};
</script>

<style scoped>
a {
text-decoration: none !important;
}

.card-opacity {
background-color: rgba(125, 227, 200, 0.12);
}
</style>
Loading