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

feat(tailwind-components): update header for design #4356

Merged
merged 2 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
28 changes: 15 additions & 13 deletions apps/tailwind-components/components/BreadCrumbs.vue
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
<script setup>
defineProps({
crumbs: {
type: Object,
default: [],
required: false,
},
current: {
type: String,
required: false,
},
});
<script setup lang="ts">
withDefaults(
defineProps<{
crumbs?: Record<string, string>;
current?: string | undefined;
align?: "left" | "center";
}>(),
{
crumbs: () => ({}),
current: undefined,
align: "center",
}
);
</script>

<template>
Expand All @@ -24,7 +25,8 @@ defineProps({
</a> -->
</div>
<nav
class="items-center justify-center hidden gap-3 tracking-widest xl:flex font-display text-heading-lg"
class="items-center hidden gap-3 tracking-widest xl:flex font-display text-heading-lg"
:class="{ 'justify-center': align === 'center' }"
>
<template v-for="(url, label, index) in crumbs" :key="label">
<NuxtLink :to="url" class="text-breadcrumb hover:underline">{{
Expand Down
34 changes: 18 additions & 16 deletions apps/tailwind-components/components/PageHeader.vue
Original file line number Diff line number Diff line change
@@ -1,30 +1,32 @@
<script setup>
<script setup lang="ts">
import { useSlots } from "vue";

const slots = useSlots();

defineProps({
title: {
type: String,
required: true,
},
description: { type: String },
icon: {
type: String,
},
truncate: {
type: Boolean,
default: true,
},
});
withDefaults(
defineProps<{
title: string;
description?: string;
icon?: string;
truncate?: boolean;
align?: "left" | "center";
}>(),
{
truncate: true,
align: "center",
}
);
</script>

<template>
<header class="flex flex-col px-5 pt-5 pb-6 antialiased lg:pb-10 lg:px-0">
<div class="mb-6" v-if="slots.prefix">
<slot name="prefix"></slot>
</div>
<div class="flex flex-col items-center text-title">
<div
class="flex flex-col text-title"
:class="{ 'items-center': align === 'center' }"
>
<span class="mb-2 mt-2.5 xl:block hidden text-icon" v-if="icon">
<BaseIcon :name="icon" :width="55" />
</span>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script setup lang="ts">
defineProps<{
title: string;
title?: string;
description?: string;
}>();
</script>
Expand Down
28 changes: 28 additions & 0 deletions apps/tailwind-components/pages/BreadCrumbs.story.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<template>
<p class="pb-3">Default breadcrumbs, with 3 items</p>
<div>
<BreadCrumbs :crumbs="crumbs" />
</div>

<p class="pt-6 pb-3">Breadcrumbs aligined left</p>
<div>
<BreadCrumbs :crumbs="crumbs" align="left" />
</div>

<p class="pt-6 pb-3">Breadcrumbs with 'item 4' as current</p>
<div>
<BreadCrumbs :crumbs="crumbs" current="item 4" align="left" />
</div>
</template>

<script setup lang="ts">
const route = useRoute();
interface Crumbs {
[key: string]: string;
}

const crumbs = ref<Crumbs>({});
crumbs.value["item 1"] = route.path;
crumbs.value["item 2"] = route.path;
crumbs.value["item 3"] = route.path;
</script>
26 changes: 12 additions & 14 deletions apps/ui/pages/[schema]/[table]/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -86,27 +86,25 @@ function handleSettingsUpdate(settings: ITableSettings) {

router.push({ query });
}

const crumbs = computed(() => {
let crumb: { [key: string]: string } = {};
crumb[schemaId] = `/${schemaId}`;
return crumb;
});
const current = computed(
() => tableMetaData.value?.label ?? tableMetaData.value?.id ?? ""
);
</script>
<template>
<Container>
<PageHeader :title="tableMetaData?.label">
<PageHeader :title="tableMetaData?.label ?? ''" align="left">
<template #prefix>
<BreadCrumbs
:crumbs="{
databases: '/',
tables: `/${schemaId}`,
[tableMetaData?.label ||
tableMetaData?.id ||
'']: `/${schemaId}/${tableId}`,
}"
/>
<BreadCrumbs :align="'left'" :crumbs="crumbs" :current="current" />
</template>
</PageHeader>

<ContentBlock
:title="tableMetaData?.label || tableMetaData?.id || ''"
:description="tableMetaData?.description"
>
<ContentBlock>
<div v-if="status === 'pending'">Loading...</div>
<div v-if="error">Error: {{ error }}</div>
<!-- <pre v-if="data">{{ tableMetaData }}</pre> -->
Expand Down
9 changes: 2 additions & 7 deletions apps/ui/pages/[schema]/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,9 @@ const ontologies = computed(
</script>
<template>
<Container>
<PageHeader :title="`Tables in ${data?.data._schema.label}`">
<PageHeader :title="`Tables in ${data?.data._schema.label}`" align="left">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think I like the left align. Is that a design we agreed upon?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i makes sense as the whole page is left aligned and fullscreen ( yet to be implemented for the rest of the page) , its a different design then the catalogue list page

<template #prefix>
<BreadCrumbs
:crumbs="{
databases: '/',
tables: `/${schema}`,
}"
/>
<BreadCrumbs align="left" :current="data?.data._schema.label" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that is nice.

</template>
</PageHeader>

Expand Down