-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(site): simplify customer stories
- Loading branch information
1 parent
b17af32
commit a19a931
Showing
10 changed files
with
265 additions
and
260 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,92 +1,58 @@ | ||
<template> | ||
<div | ||
:class="classes" | ||
class="wrapper" | ||
> | ||
<div class="icon" :style="styles" /> | ||
<div ref="root" class="icon-wrapper" data-bs-toggle="tooltip" data-bs-placement="top" :title="cls"> | ||
<div class="icon" :style="styles" /> | ||
</div> | ||
</template> | ||
<script> | ||
import {Buffer} from "buffer"; | ||
export default { | ||
name: "TaskIcon", | ||
// components: {Tooltip}, | ||
props: { | ||
customIcon: { | ||
type: Object, | ||
default: undefined | ||
}, | ||
cls: { | ||
type: Object, | ||
default: undefined | ||
}, | ||
theme: { | ||
type: String, | ||
default: undefined, | ||
validator(value) { | ||
return ["dark", "light"].includes(value) | ||
} | ||
} | ||
|
||
<script setup> | ||
const {$bootstrap} = useNuxtApp() | ||
const props = defineProps({ | ||
cls: { | ||
type: String, | ||
default: undefined | ||
}, | ||
computed: { | ||
backgroundImage() { | ||
return `data:image/svg+xml;base64,${this.imageBase64}` | ||
}, | ||
classes() { | ||
return { | ||
"flowable": this.icon ? this.icon.flowable : false, | ||
} | ||
}, | ||
styles() { | ||
return { | ||
backgroundImage: `url(data:image/svg+xml;base64,${this.imageBase64})` | ||
} | ||
}, | ||
imageBase64() { | ||
let icon = this.icon && this.icon.icon ? Buffer.from(this.icon.icon, "base64").toString("utf8") : undefined; | ||
}); | ||
const styles = computed(() => { | ||
return { | ||
background: `url("/icons/${props.cls}.svg")` | ||
} | ||
}) | ||
const root = ref(null) | ||
if (!icon) { | ||
icon = "<svg xmlns=\"http://www.w3.org/2000/svg\" " + | ||
"xmlns:xlink=\"http://www.w3.org/1999/xlink\" aria-hidden=\"true\" " + | ||
"focusable=\"false\" width=\"0.75em\" height=\"1em\" style=\"-ms-transform: " + | ||
"rotate(360deg); -webkit-transform: rotate(360deg); transform: rotate(360deg);\" " + | ||
"preserveAspectRatio=\"xMidYMid meet\" viewBox=\"0 0 384 512\">" + | ||
"<path d=\"M288 32H0v448h384V128l-96-96zm64 416H32V64h224l96 96v288z\" fill=\"currentColor\"/>" + | ||
"</svg>"; | ||
} | ||
onMounted(() => { | ||
if (process.client) { | ||
new $bootstrap.Tooltip(root.value); | ||
} | ||
}); | ||
return Buffer.from(icon, "utf8").toString("base64"); | ||
}, | ||
icon() { | ||
return this.cls; | ||
onBeforeUnmount(() => { | ||
if (process.client) { | ||
const tooltip = $bootstrap.Tooltip.getInstance(root.value); | ||
if (tooltip) { | ||
tooltip.dispose(); | ||
} | ||
} | ||
} | ||
}); | ||
</script> | ||
|
||
<style lang="scss" scoped> | ||
.wrapper { | ||
.icon-wrapper { | ||
display: inline-block; | ||
width: 100%; | ||
height: 100%; | ||
position: relative; | ||
:deep(span) { | ||
position: absolute; | ||
padding: 1px; | ||
left: 0; | ||
display: block; | ||
width: 100%; | ||
height: 100%; | ||
} | ||
:deep(.icon) { | ||
.icon { | ||
width: 100%; | ||
height: 100%; | ||
display: block; | ||
background-size: contain; | ||
background-repeat: no-repeat; | ||
background-position: center center; | ||
background-size: contain !important; | ||
background-repeat: no-repeat !important; | ||
background-position: center center !important; | ||
} | ||
} | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,71 +1,83 @@ | ||
<template> | ||
<NuxtLink :href="`/use-cases/stories/${story.title.split(' ').join('-').toLowerCase()}`"> | ||
<div class="card" data-aos="fade-right"> | ||
<div class="card-body d-flex flex-column justify-content-between "> | ||
<div> | ||
<NuxtImg loading="lazy" format="webp" quality="80" densities="x1 x2" :src="story.featuredImage" :alt="`${story.title} image`" class="card-img-top rounded-3" /> | ||
<p class="card-title mt-3 mb-2 text-pink">{{ story.title }}</p> | ||
<p class="card-meta-description">{{ story.description }}</p> | ||
<div class="d-flex flex-wrap gap-3 my-3" v-if="icons"> | ||
<div class="icon" v-for="task in story.tasks" :key="task"> | ||
<CommonTaskIcon :cls="icons[task]"/> | ||
</div> | ||
</div> | ||
</div> | ||
<span class="author text-primary"> | ||
<NuxtLink :href="`/use-cases/stories/${story.id}-${slugify(story.title)}`"> | ||
<div class="card" data-aos="fade-right"> | ||
<div class="card-body d-flex flex-column justify-content-between "> | ||
<div> | ||
<NuxtImg | ||
loading="lazy" | ||
format="webp" | ||
quality="80" | ||
densities="x1 x2" | ||
:src="story.featuredImage" | ||
:alt="`${story.title} image`" | ||
class="card-img-top rounded-3" | ||
/> | ||
<p class="card-title mt-3 mb-2 text-pink">{{ story.title }}</p> | ||
<p class="card-meta-description">{{ story.description }}</p> | ||
<div class="d-flex flex-wrap gap-3 my-3"> | ||
<div class="icon" v-for="task in story.tasks" :key="task"> | ||
<CommonTaskIcon :cls="task" /> | ||
</div> | ||
</div> | ||
</div> | ||
<span class="author text-primary"> | ||
Read the Story <img src="/stories/icons/arrow_right_alt.svg" alt="right icons" /> | ||
</span> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</NuxtLink> | ||
</template> | ||
|
||
<script setup> | ||
defineProps({ | ||
story: { | ||
type: Object, | ||
required: true, | ||
}, | ||
icons: { | ||
type: Object, | ||
required: true, | ||
}, | ||
}); | ||
import {slugify} from "~/utils/url.js"; | ||
defineProps({ | ||
story: { | ||
type: Object, | ||
required: true, | ||
} | ||
}); | ||
</script> | ||
|
||
<style lang="scss" scoped> | ||
@import "../../assets/styles/variable"; | ||
.card { | ||
height: 100%; | ||
@import "../../assets/styles/variable"; | ||
.card-body { | ||
.type { | ||
font-size: $font-size-sm; | ||
color: $primary; | ||
} | ||
.card { | ||
height: 100%; | ||
.author { | ||
font-size: $font-size-sm; | ||
color: $gray-500; | ||
margin-bottom: 0; | ||
} | ||
.card-body { | ||
.type { | ||
font-size: $font-size-sm; | ||
color: $primary; | ||
} | ||
.author { | ||
font-size: $font-size-sm; | ||
color: $gray-500; | ||
margin-bottom: 0; | ||
} | ||
.icon { | ||
border: 1px solid $white-2; | ||
padding: 0.313rem 0.625rem; | ||
width: 44px; | ||
} | ||
} | ||
&-title { | ||
font-size: $font-size-xs; | ||
line-height: 1.625rem; | ||
} | ||
&-name { | ||
font-size: $font-size-xs !important; | ||
line-height: 1.75rem !important; | ||
text-transform: uppercase !important; | ||
} | ||
.icon { | ||
border: 1px solid $white-2; | ||
padding: 0.313rem 0.625rem; | ||
width: 44px; | ||
&-meta-description { | ||
font-weight: 700; | ||
font-size: $h6-font-size; | ||
} | ||
} | ||
} | ||
&-title { | ||
font-size: $font-size-xs; | ||
line-height: 1.625rem; | ||
} | ||
&-name { | ||
font-size: $font-size-xs !important; | ||
line-height: 1.75rem !important; | ||
text-transform: uppercase !important; | ||
} | ||
&-meta-description{ | ||
font-weight: 700; | ||
font-size: $h6-font-size; | ||
} | ||
} | ||
</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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
Oops, something went wrong.