docs: improve site page (#6826)

pull/6871/head
Konv Suu 1 year ago committed by GitHub
parent 6ced156342
commit 141f0100d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,6 +1,6 @@
<template> <template>
<Header /> <Header />
<div v-if="headers.length" class="toc-affix" :style="y > 60 ? 'position:fixed; top: 16px;' : ''"> <div v-if="headers.length" class="toc-affix" :style="y > 102 ? 'position:fixed; top: 16px;' : ''">
<a-anchor style="width: 160px" :items="headers"> <a-anchor style="width: 160px" :items="headers">
<template #customTitle="item"> <template #customTitle="item">
<LinkOutlined v-if="item.target" /> <LinkOutlined v-if="item.target" />

@ -19,14 +19,14 @@ a {
.main-wrapper { .main-wrapper {
position: relative; position: relative;
padding: 40px 0 0; padding: 0;
background: var(--component-background); background: var(--component-background);
} }
.main-container { .main-container {
position: relative; position: relative;
min-height: 500px; min-height: 500px;
padding: 0 170px 32px 64px; padding: 40px 170px 32px 64px;
background: var(--component-background); background: var(--component-background);
.ant-row-rtl & { .ant-row-rtl & {

@ -69,7 +69,7 @@ ul.toc > li {
.toc-affix { .toc-affix {
position: absolute; position: absolute;
top: 80px; top: 118px;
right: 0px; right: 0px;
width: 160px; width: 160px;
padding: 8px 8px 8px 4px; padding: 8px 8px 8px 4px;

@ -23,6 +23,18 @@
box-shadow: var(--shadow-2); box-shadow: var(--shadow-2);
} }
} }
&-affix {
transition: all 0.25s;
}
&-affixed {
padding: 12px;
margin: -8px;
border-radius: 6px;
border: 1px solid var(--border-color-base);
background-color: var(--body-background);
}
} }
.components-overview-search { .components-overview-search {

@ -12,17 +12,25 @@
</p> </p>
</section> </section>
<a-divider></a-divider> <a-divider></a-divider>
<a-affix :offset-top="32" @change="handleAffixChange">
<div
class="components-overview-affix"
:class="{ 'components-overview-affixed': searchBarAffixed }"
>
<a-input <a-input
ref="inputRef" ref="inputRef"
v-model:value="search" v-model:value="search"
:placeholder="$t('app.components.overview.search')" :placeholder="$t('app.components.overview.search')"
class="components-overview-search" class="components-overview-search"
auto-focus auto-focus
:style="{ fontSize: searchBarAffixed ? '18px' : '' }"
> >
<template #suffix> <template #suffix>
<SearchOutlined /> <SearchOutlined />
</template> </template>
</a-input> </a-input>
</div>
</a-affix>
<a-divider></a-divider> <a-divider></a-divider>
<template v-for="group in menuItems" :key="group.title"> <template v-for="group in menuItems" :key="group.title">
<div class="components-overview"> <div class="components-overview">
@ -84,6 +92,12 @@ export default defineComponent({
const search = ref(''); const search = ref('');
const inputRef = ref(); const inputRef = ref();
const { dataSource } = useMenus(); const { dataSource } = useMenus();
const searchBarAffixed = ref(false);
function handleAffixChange(affixed?: boolean) {
searchBarAffixed.value = affixed;
}
const menuItems = computed(() => { const menuItems = computed(() => {
return [ return [
{ {
@ -144,6 +158,8 @@ export default defineComponent({
inputRef, inputRef,
isZhCN: globalConfig?.isZhCN, isZhCN: globalConfig?.isZhCN,
isDark, isDark,
searchBarAffixed,
handleAffixChange,
}; };
}, },
}); });

Loading…
Cancel
Save