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(about-section): new component [khcp-8589] #782

Merged
merged 18 commits into from
Sep 15, 2023
Merged
73 changes: 72 additions & 1 deletion packages/core/app-layout/sandbox/pages/PageHeaderPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,71 @@
</div>
</template>
</AppPageHeader>

<AppAboutSection
created="2023-02-17"
description="Some cats are cool, some are not. This one is cool."
modified="2023-02-17 15:23:34"
title="About this Cat"
>
<template #actions>
<KButton
appearance="btn-link"
class="about-action-button"
>
<template #icon>
<KIcon
color="#0044f4"
icon="pencil"
size="16"
/>
</template>
</KButton>
</template>

<div>
<span class="badge-label">Name:</span>
<KBadge
appearance="neutral"
shape="rectangular"
>
TK
</KBadge>
</div>
<div>
<span class="badge-label">Type:</span>
<KBadge
appearance="success"
shape="rectangular"
>
COOL
</KBadge>
</div>

<template #divider-section>
<div>
This cat has a habit of sleeping in uncomfortable looking positions.
</div>
<div>
<KButton appearance="btn-link">
<template #icon>
🍔
</template>
I can haz cheezeburger
</KButton>
</div>
<hr>
<div>
I have a lot to say about cats.
</div>
</template>
</AppAboutSection>
</div>
</template>

<script setup lang="ts">
import { computed, ref } from 'vue'
import { AppPageHeader } from '../../src'
import { AppAboutSection, AppPageHeader } from '../../src'

const breadcrumbs = computed(() => {
return [
Expand Down Expand Up @@ -98,4 +157,16 @@ const enabled = ref(false)
.actions-switch {
margin-right: 12px;
}

.about-action-button {
display: flex;
min-height: unset !important;
height: 16px !important;
}

.badge-label {
font-size: 12px;
line-height: 16px;
margin-right: 8px;
}
</style>
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
<template>
<KCard class="kong-ui-app-about-section">
<template
v-if="title"
#title
>
<div class="about-section-title">
{{ title }}
</div>
adamdehaven marked this conversation as resolved.
Show resolved Hide resolved
</template>

<template
v-if="$slots.actions || created || modified"
#actions
>
<!-- TODO: translation -->
<div class="about-section-header-end">
<div
v-if="created || modified"
class="about-section-timestamps"
:class="{ 'has-actions': $slots.actions }"
>
<span
v-if="created"
class="about-section-timestamps-created"
>{{ createdLabel || 'Created' }}: {{ created }}</span>
<!-- TODO: use new icon instead of KIcon -->
<span
v-if="created && modified"
class="about-section-timestamps-arrow"
>-></span>
<span
v-if="modified"
class="about-section-timestamps-modified"
>{{ modifiedLabel || 'Modified' }}: {{ modified }}</span>
</div>
kaiarrowood marked this conversation as resolved.
Show resolved Hide resolved

<div
v-if="$slots.actions"
class="about-section-actions"
data-testid="about-section-actions"
>
<slot name="actions" />
</div>
</div>
</template>

<template #body>
<div
v-if="description"
class="about-section-description"
>
{{ description }}
</div>
kaiarrowood marked this conversation as resolved.
Show resolved Hide resolved

<div
v-if="$slots.default"
class="about-section-content"
>
<slot />
kaiarrowood marked this conversation as resolved.
Show resolved Hide resolved
</div>

<hr v-if="$slots['divider-section']">

<div
v-if="$slots['divider-section']"
class="about-divider-section"
>
<slot name="divider-section" />
</div>
</template>
</KCard>
</template>

<script setup lang="ts">
defineProps({
title: {
type: String,
default: '',
},
description: {
type: String,
default: '',
},
created: {
type: String,
default: '',
},
createdLabel: {
type: String,
default: '',
},
modified: {
type: String,
default: '',
},
modifiedLabel: {
type: String,
default: '',
},
Copy link
Member

Choose a reason for hiding this comment

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

question: why would the createdLabel or modifiedLabel ever be different text?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For User/Developer pages we are going to display Joined instead of Created

Copy link
Member

Choose a reason for hiding this comment

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

If that's the case, should the prop names for created/modified be more generic?

e.g. createdLabel: 'Joined' seems a bit confusing

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you have a suggestion, it maps to created_at/updated_at fields most of the time.

})
</script>

<style lang="scss" scoped>
.kong-ui-app-about-section {
.about-section-title {
color: $kui-color-text;
font-size: $kui-font-size-40;
font-weight: $kui-font-weight-bold;
letter-spacing: $kui-letter-spacing-minus-20;
line-height: $kui-line-height-30;
}

.about-section-header-end {
display: flex;
.about-section-timestamps {
color: $kui-color-text-neutral;
font-size: $kui-font-size-20;
line-height: $kui-line-height-20;

&.has-actions {
margin-right: $kui-space-60;
}

.about-section-timestamps-arrow {
line-height: $kui-line-height-30;
margin-left: $kui-space-40;
margin-right: $kui-space-40;
}
}
}

.about-section-description {
color: $kui-color-text;
font-size: $kui-font-size-30;
line-height: $kui-line-height-30;
margin-bottom: $kui-space-70;
}

.about-section-content {
align-items: flex-start;
align-self: stretch;
color: $kui-color-text-neutral;
column-gap: $kui-space-70;
display: flex;
font-size: $kui-font-size-30;
line-height: $kui-line-height-30;
padding: $kui-space-0;
}

.about-divider-section {
color: $kui-color-text-neutral;
display: flex;
flex-direction: column;
font-size: $kui-font-size-30;
line-height: $kui-line-height-30;
row-gap: $kui-space-50;
}

:deep(hr),
hr {
background-color: $kui-color-border;
border: none;
height: 1px;
margin: $kui-space-0;
width: 100%;
}

hr {
margin-bottom: $kui-space-50;
margin-top: $kui-space-50;
}
}
</style>

<style lang="scss">
.kong-ui-app-about-section.kong-card.border {
border-radius: $kui-border-radius-20;
padding: $kui-space-70;

.k-card-header {
align-items: baseline;
margin-bottom: $kui-space-0 !important;
}
}
kaiarrowood marked this conversation as resolved.
Show resolved Hide resolved
</style>
2 changes: 2 additions & 0 deletions packages/core/app-layout/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { App } from 'vue'

import AccountDropdown from './components/navbar/AccountDropdown.vue'
import AppAboutSection from './components/aboutSection/AppAboutSection.vue'
import AppError from './components/errors/AppError.vue'
import AppLayout from './components/AppLayout.vue'
import AppNavbar from './components/navbar/AppNavbar.vue'
Expand All @@ -20,6 +21,7 @@ export default {
// Export individual Components
export {
AccountDropdown,
AppAboutSection,
AppError,
AppLayout,
AppNavbar,
Expand Down