feat: new layout

This commit is contained in:
MoreStrive
2024-06-28 15:39:26 +07:00
parent ab3419bd5f
commit ad962eda86
134 changed files with 4977 additions and 2985 deletions
@@ -0,0 +1,242 @@
<script setup lang="ts">
import { enumPageComponentTemplates } from "@/definitions/enum";
import { DEFAULT_QUERY_DROP } from "@/utils/parseSQL";
import { isEmpty } from "lodash";
const emit = defineEmits(["dropData", "selectComponent"]);
import { getInputValue } from "@/utils/parseSQL";
const _props = defineProps<{
dataResult?: any;
dataType?: any;
dataQuery?: any;
layout?: string;
label?: string;
}>();
const SETTING_OPTIONS = {
BREADCRUMB_MAX_ELEMENT: 3,
};
const LAYOUT_PARSE = computed(() => {
const designObject = _props.label ? getInputValue(_props.label, "OBJECT") : {};
return Object.assign({}, designObject);
});
const selectComponent = () => {
emit("selectComponent");
};
const parseData = computed(() => {
if (!_props.dataResult) return;
const result = getInputValue(_props.dataResult, "OBJECT");
return result;
});
const drop = (e: any) => {
if (e.dataTransfer.getData(`${enumPageComponentTemplates.ARTICLE}`)) {
const data = e.dataTransfer.getData(`${enumPageComponentTemplates.ARTICLE}`);
const { dataType, dataResult } = JSON.parse(data);
const dataQuery = DEFAULT_QUERY_DROP(dataType, dataResult.id);
emit("dropData", {
dataType,
dataResult,
dataQuery: dataQuery,
});
}
};
const articleStore = useArticleStore();
console.log(articleStore.currentArticleGeneral, "cas");
const currentArticle = computed(() => articleStore.currentArticleGeneral);
</script>
<template>
<div @click="selectComponent" class="overflow-hidden" @dragover.prevent @drop.stop.prevent="drop">
<div class="breadcrumb" v-if="!LAYOUT_PARSE['HideBreadcrumb']">
<ul class="breadcrumb__list">
<li
class="breadcrumb__list__item"
v-for="(item, index) in _props.dataResult && _props.dataResult?.length > 0 ? _props.dataResult : Array(SETTING_OPTIONS.BREADCRUMB_MAX_ELEMENT).fill(null)"
:key="index"
:class="isEmpty(item) && 'empty'"
>
<p v-if="!isEmpty(item)" class="breadcrumb__list__item__title">
{{ item?.title }}
</p>
</li>
</ul>
<nuxt-link class="article-card-default__topic" :to="`#`">
<h5>Topic</h5>
</nuxt-link>
</div>
<div class="content">Nội dung bài viết sẽ đây</div>
<!-- <div class="btn-wrap" v-if="!LAYOUT_PARSE['HideCopylink']">
<div class="center-y">
<p title="Quay trở lại" class="button--back">
<Icon name="fa6-solid:arrow-left" />
</p>
<button class="button--bookmark">
<Icon name="fa6-regular:bookmark" />
</button>
</div>
<div class="center-y">
<button title="Copy link" class="button--back">
<Icon name="mdi:link-variant" />
</button>
</div>
</div> -->
</div>
</template>
<style scoped lang="scss">
.breadcrumb {
display: flex;
justify-content: space-between;
margin-bottom: 20px;
&__list {
margin: 0;
padding: 0px;
display: flex;
overflow-x: auto;
gap: 1.5rem;
align-items: center;
font-size: 0.875rem;
line-height: 1.25rem;
&__item {
display: inline-block;
position: relative;
&__title {
margin: 0;
font-size: 18px;
color: #000;
font-weight: 500;
text-transform: uppercase;
line-height: 180%;
}
// &:first-child {
// color: blue;
// }
&:not(:first-child):before {
content: "\\";
position: absolute;
left: -18px;
}
}
}
.article-card-default__topic {
position: relative;
// background-color: #151411;
display: inline-block;
h5 {
font-size: 12px;
display: flex;
align-items: center;
justify-content: center;
text-transform: uppercase;
// color: #fff;
padding: 0 12px;
height: 100%;
margin: 0;
border: 1px solid #000;
line-height: 180%;
font-weight: 300;
}
&::after {
position: absolute;
content: "";
display: block;
width: 12px;
height: 100%;
background-color: #ed1c24;
left: -12px;
top: 0;
}
}
}
.empty {
border-radius: 6px;
background: #409eff;
width: 40px;
min-height: 20px;
}
.content {
font-size: 20px;
display: flex;
align-items: center;
justify-content: center;
height: 300px;
padding: 20px;
border-radius: 8px;
background: #eeeeee;
overflow: hidden;
margin-bottom: 20px;
}
.title {
white-space: normal;
}
.intro {
white-space: normal;
padding-bottom: 10px;
display: block;
}
.detail {
white-space: normal;
}
// .btn-wrap {
// display: flex;
// flex-wrap: wrap;
// justify-content: space-between;
// align-items: center;
// @media (min-width: 768px) {
// flex-direction: row;
// }
// .class-default,
// .button--back {
// border-radius: 9999px;
// border-width: 1px;
// width: 3rem;
// height: 3rem;
// margin: 0;
// font-size: 17px;
// display: flex;
// align-items: center;
// justify-content: center;
// background-color: #ffffff;
// border: 1px solid rgb(229, 231, 235);
// box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
// &:hover {
// background-color: #e6f4ff;
// color: #3c7abc;
// }
// }
// .button--bookmark {
// width: 32px;
// height: 32px;
// border-radius: 200px;
// background-color: white;
// display: flex;
// align-items: center;
// justify-content: center;
// border: none;
// &:hover {
// background-color: #e6f4ff;
// color: #3c7abc;
// }
// }
// }
.center-y {
display: flex;
gap: 1rem;
align-items: center;
}
</style>
@@ -0,0 +1,176 @@
<script setup lang="ts">
import { isEmpty } from "lodash";
const emit = defineEmits(["dropData", "selectComponent"]);
const _props = defineProps<{
dataResult?: any[];
}>();
const SETTING_OPTIONS = {
BREADCRUMB_MAX_ELEMENT: 3,
};
</script>
<template>
<div class="overflow-hidden">
<div class="breadcrumb">
<ul class="breadcrumb__list">
<li
class="breadcrumb__list__item"
v-for="(item, index) in _props.dataResult && _props.dataResult?.length > 0 ? _props.dataResult : Array(SETTING_OPTIONS.BREADCRUMB_MAX_ELEMENT).fill(null)"
:key="index"
:class="isEmpty(item) && 'empty'"
>
<p v-if="!isEmpty(item)" class="breadcrumb__list__item__title">
{{ item?.title }}
</p>
</li>
</ul>
<p class="breakcrumb__time">Ngày tạo image</p>
</div>
<div class="content">Nội dung bài viết sẽ đây</div>
<div class="btn-wrap w-100 max-w">
<div class="center-y">
<p title="Quay trở lại" class="button--back">
<Icon name="fa6-solid:arrow-left" />
</p>
<button class="button--bookmark">
<Icon name="fa6-regular:bookmark" />
</button>
</div>
<div class="center-y">
<button title="Copy link" class="button--back copy-link">
<Icon name="mdi:link-variant" />
</button>
</div>
</div>
</div>
</template>
<style scoped lang="scss">
$max-width: 680px;
.breadcrumb {
display: flex;
justify-content: space-between;
margin-bottom: 20px;
&__list {
padding: 0px;
display: flex;
overflow-x: auto;
gap: 1.5rem;
align-items: center;
font-size: 0.875rem;
line-height: 1.25rem;
&__item {
display: inline-block;
position: relative;
&:first-child {
color: blue;
}
&:not(:first-child):before {
content: "";
width: 7px;
height: 7px;
border-top: 1px solid #bdbdbd;
border-right: 1px solid #bdbdbd;
transform: rotate(45deg);
position: absolute;
left: -18px;
top: 8px;
}
}
}
&__time {
color: #9f9f9f;
font-size: 14px;
margin-bottom: 8px;
}
}
.empty {
border-radius: 6px;
background: #409eff;
width: 40px;
min-height: 20px;
}
.content {
font-size: 20px;
display: flex;
align-items: center;
justify-content: center;
height: 300px;
padding: 20px;
border-radius: 8px;
background: #eeeeee;
overflow: hidden;
margin-bottom: 20px;
}
.title {
white-space: normal;
}
.intro {
white-space: normal;
padding-bottom: 10px;
display: block;
}
.detail {
white-space: normal;
}
.btn-wrap {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
align-items: center;
@media (min-width: 768px) {
flex-direction: row;
}
.class-default,
.button--back,
.button--bookmark {
border-radius: 8px;
border-width: 1px;
width: 40px;
height: 40px;
margin: 0;
font-size: 17px;
display: flex;
align-items: center;
justify-content: center;
background-color: #ffffff;
border: 1px solid rgb(229, 231, 235);
box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
&:hover {
background-color: #e6f4ff;
color: #3c7abc;
}
&.copy-link {
border-radius: 999px;
}
}
}
.breadcrumb,
.btn-wrap {
max-width: $max-width;
margin: auto;
}
.center-y {
display: flex;
gap: 1rem;
align-items: center;
}
</style>
@@ -0,0 +1,318 @@
<script setup lang="ts">
</script>
<template>
<div
class="podcast__wrapper overflow-hidden"
>
<div
class="podcast"
>
<p
class="podcast__content__time"
>
Ngày tạo podcast
</p>
<figure><img src="http://picsum.photos/1024/600?random=1'" alt="Ảnh podcast" title="Ảnh podcast" /></figure>
<div
class="podcast__content"
>
<p
class="podcast__content__time"
>
Ngày tạo podcast
</p>
<h1 class="podcast__content__title">Tiêu đề podcast</h1>
<p
class="podcast__content__text"
>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</p>
</div>
<ul
class="buttons"
>
<li><Icon name="mdi:bookmark-outline" /></li>
<li><Icon name="material-symbols:mode-comment-outline" /></li>
</ul>
</div>
<div class="playlist">
<div class="playlist__time">
<span>5:00</span>
<span>10:00</span>
</div>
<div class="playlist__buttons">
<div class="playlist__buttons__left">
<div
class="button__prev"
>
<Icon name="material-symbols:skip-previous" />
</div>
<div
class="sound"
>
<Icon name="material-symbols:volume-mute"></Icon>
<div></div>
<Icon name="material-symbols:volume-up"></Icon>
</div>
</div>
<div class="play">
<Icon name="fluent:skip-back-10-48-filled" />
<Icon name="material-symbols:play-arrow" class="button" />
<Icon name="fluent:skip-forward-10-48-filled" />
</div>
<div class="playlist__buttons__right">
<div
class="button__next"
>
<Icon name="material-symbols:skip-next" />
</div>
<div
class="speed"
>
<span>Tốc độ phát: </span>
<strong>1x</strong>
</div>
</div>
</div>
</div>
<p
class="podcast__content__text"
>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</p>
</div>
</template>
<style lang="scss">
:root {
--podcast-wrapper-padding: 40;
}
.podcast-padding-tablet {
--podcast-wrapper-padding: 30;
}
.podcast-padding-smartphone {
--podcast-wrapper-padding: 20;
}
.podcast__wrapper {
padding: calc(var(--podcast-wrapper-padding) * 1px);
border: 1px solid #eeeeee;
box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.1);
border-radius: 8px;
.podcast {
display: flex;
justify-content: space-between;
gap: 24px;
align-items: center;
margin-bottom: 10px;
& > figure > img {
width: 150px;
height: 150px;
border-radius: 8px;
box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
cursor: pointer;
}
&__content__text {
font-size: 18px;
overflow: hidden;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 3;
}
&__content {
flex: 1;
color: #222222;
margin: 0;
&__time {
color: #9f9f9f;
font-size: 14px;
margin-bottom: 8px;
}
&__title {
font-size: 24px;
margin-bottom: 16px;
font-weight: bold;
}
@media (max-width: 768px) {
text-align: center;
&__time {
display: none;
}
&__text {
display: none;
}
}
}
& > .buttons {
display: flex;
align-self: start;
gap: 8px;
margin: 0;
padding: 0;
& li {
list-style: none;
width: 36px;
height: 36px;
background-color: white;
border: 1px solid rgb(229, 231, 235);
cursor: pointer;
box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
border-radius: 50px;
position: relative;
&:hover {
background-color: #e6f4ff;
color: #3c7abc;
}
& svg {
font-size: 18px;
position: absolute;
top: 50%;
left: 50%;
transform: translateY(-50%) translateX(-55%);
}
}
}
@media (max-width: 768px) {
flex-direction: column;
& .buttons {
display: none;
}
}
}
.playlist {
padding: 8px;
&__time {
display: flex;
justify-content: space-between;
padding-top: 12px;
position: relative;
&::after,
&::before {
content: "";
position: absolute;
height: 4px;
top: 0;
cursor: pointer;
}
&::after {
width: 100%;
background-color: #e6f4ff;
z-index: 1;
}
&::before {
width: 50%;
background-color: #3c7abc;
z-index: 2;
}
& span {
font-size: 16px;
color: #3c7abc;
font-weight: 500;
}
}
&__buttons {
display: flex;
justify-content: space-between;
align-items: center;
& .button__prev,
& .button__next {
font-size: 28px;
color: #3c7abc;
}
& .sound {
display: inline-flex;
align-items: center;
gap: 8px;
margin-left: -10px;
padding: 0 10px;
height: 36px;
color: #3c7abc;
border-radius: 8px;
font-size: 28px;
cursor: pointer;
&:hover {
background-color: #e6f4ff;
}
& > div {
width: 50px;
height: 2px;
position: relative;
background-color: #dcf0ff;
&::after {
position: absolute;
content: "";
top: 0;
height: 2px;
width: 50%;
background-color: #3c7abc;
}
}
}
& .play {
display: flex;
align-items: center;
justify-content: center;
gap: 16px;
flex: 1;
& svg {
font-size: 28px;
color: #3c7abc;
&.button {
font-size: 64px;
}
}
}
& .speed {
font-size: 14px;
color: #3c7abc;
& span {
font-weight: 200;
}
& strong {
font-weight: bold;
font-size: 20px;
margin-left: 4px;
}
}
}
}
}
</style>
@@ -0,0 +1,42 @@
<script setup lang="ts">
import Comment from "@/components/dynamic-page/page-component/templates/others/comments/Default.vue";
</script>
<template>
<div class="container overflow-hidden">
<div class="video row">
<div
class="video__left"
>
<video controls="controls" width="100%" height="100%" data-file-id="149" data-resource="https://acp-api.vpress.vn/Resources/Video/983d2f57-7743-472f-b22d-fc73085af6d5.mp4" data-title="Download.mp4">
<source src="" type="video/mp4" />
</video>
</div>
<div
class="video__right bg-body-tertiary"
>
<h1
class=""
>
Tiêu đề video
</h1>
<p class="line-clamp-3 fs-5 fw-light">
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</p>
<h5 class="text-end fs-4 opacity-75">Tác giả</h5>
<p><b class="text-primary fw-semibold">Danh mục</b> <span class="ms-2 opacity-25 fw-semibold">Ngày đăng video</span></p>
<Comment />
</div>
</div>
</div>
</template>
<style scoped lang="scss">
.line-clamp-3 {
overflow: hidden;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 3;
}
</style>
@@ -0,0 +1,6 @@
// export { default as Article_Card } from './cards/Card.vue'
export { default as Article_Detail_General } from './General.vue'
export { default as Article_Detail_Podcast } from './Podcast.vue'
export { default as Article_Detail_Video } from './Video.vue'
export { default as Article_Detail_Image } from './Image.vue'
@@ -0,0 +1,37 @@
<script lang="ts" setup>
import { enumPageComponentTemplate, enumPageComponentKey, enumPageComponentLayouts } from "@/definitions/enum";
// import { Article_Card, Article_Detail_Video, Article_Detail_Podcast, Article_Detail_General, Article_Detail_Image } from "./index";
import { Article_Detail_General, Article_Detail_Podcast, Article_Detail_Video, Article_Detail_Image } from "./index";
const _props = defineProps<{
settings: any;
component?: any;
content?: any;
}>();
const definedDynamicComponent: Record<string, any> = {
[enumPageComponentLayouts[enumPageComponentTemplate[enumPageComponentKey.ARTICLE]["ARTICLE_DETAIL"]]["DETAIL_GENERAL"]]: Article_Detail_General,
[enumPageComponentLayouts[enumPageComponentTemplate[enumPageComponentKey.ARTICLE]["ARTICLE_DETAIL"]]["DETAIL_PODCAST"]]: Article_Detail_Podcast,
[enumPageComponentLayouts[enumPageComponentTemplate[enumPageComponentKey.ARTICLE]["ARTICLE_DETAIL"]]["DETAIL_VIDEO"]]: Article_Detail_Video,
[enumPageComponentLayouts[enumPageComponentTemplate[enumPageComponentKey.ARTICLE]["ARTICLE_DETAIL"]]["DETAIL_IMAGE"]]: Article_Detail_Image,
};
const getCurrentComponent = computed(() => `${_props.settings.layout}`);
const GET_PROPS = computed(() => {
return () => {
let props: any = {};
if (_props.settings) {
for (const [key, value] of Object.entries(_props.settings)) {
props = {
...props,
[key]: value,
};
}
return props;
}
};
});
</script>
<template>
<component :is="definedDynamicComponent[getCurrentComponent]" v-bind="{ ...GET_PROPS(), component: _props.component, settings: _props.settings }" />
</template>