Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
90 changes: 52 additions & 38 deletions components/layout/__tests__/__snapshots__/demo.test.js.snap
Original file line number Diff line number Diff line change
@@ -1,44 +1,58 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`renders ./components/layout/demo/basic.vue correctly 1`] = `
<section class="ant-layout">
<header class="ant-layout-header">Header</header>
<main class="ant-layout-content">Content</main>
<footer class="ant-layout-footer">Footer</footer>
</section>
<section class="ant-layout">
<header class="ant-layout-header">Header</header>
<section class="ant-layout">
<aside class="ant-layout-sider ant-layout-sider-dark" style="flex: 0 0 200px; max-width: 200px; min-width: 200px; width: 200px;">
<div class="ant-layout-sider-children">Sider</div>
<!---->
</aside>
<main class="ant-layout-content">Content</main>
</section>
<footer class="ant-layout-footer">Footer</footer>
</section>
<section class="ant-layout">
<header class="ant-layout-header">Header</header>
<section class="ant-layout">
<main class="ant-layout-content">Content</main>
<aside class="ant-layout-sider ant-layout-sider-dark" style="flex: 0 0 200px; max-width: 200px; min-width: 200px; width: 200px;">
<div class="ant-layout-sider-children">Sider</div>
<!---->
</aside>
</section>
<footer class="ant-layout-footer">Footer</footer>
</section>
<section class="ant-layout">
<aside class="ant-layout-sider ant-layout-sider-dark" style="flex: 0 0 200px; max-width: 200px; min-width: 200px; width: 200px;">
<div class="ant-layout-sider-children">Sider</div>
<!---->
</aside>
<section class="ant-layout">
<header class="ant-layout-header">Header</header>
<main class="ant-layout-content">Content</main>
<footer class="ant-layout-footer">Footer</footer>
</section>
</section>
<div style="width: 100%;" class="ant-space ant-space-vertical">
<div class="ant-space-item" style="margin-bottom: 0px;">
<section class="ant-layout">
<header class="ant-layout-header" style="text-align: center; color: rgb(255, 255, 255); padding-inline: 50; line-height: 64px; background-color: rgb(125, 188, 234);">Header</header>
<main class="ant-layout-content" style="text-align: center; min-height: 120; line-height: 120px; color: rgb(255, 255, 255); background-color: rgb(16, 142, 233);">Content</main>
<footer class="ant-layout-footer" style="text-align: center; color: rgb(255, 255, 255); background-color: rgb(125, 188, 234);">Footer</footer>
</section>
</div>
<!---->
<div class="ant-space-item" style="margin-bottom: 0px;">
<section class="ant-layout">
<header class="ant-layout-header" style="text-align: center; color: rgb(255, 255, 255); padding-inline: 50; line-height: 64px; background-color: rgb(125, 188, 234);">Header</header>
<section class="ant-layout">
<aside style="text-align: center; line-height: 120px; color: rgb(255, 255, 255); background-color: rgb(59, 160, 233); flex: 0 0 200px; max-width: 200px; min-width: 200px; width: 200px;" class="ant-layout-sider ant-layout-sider-dark">
<div class="ant-layout-sider-children">Sider</div>
<!---->
</aside>
<main class="ant-layout-content" style="text-align: center; min-height: 120; line-height: 120px; color: rgb(255, 255, 255); background-color: rgb(16, 142, 233);">Content</main>
</section>
<footer class="ant-layout-footer" style="text-align: center; color: rgb(255, 255, 255); background-color: rgb(125, 188, 234);">Footer</footer>
</section>
</div>
<!---->
<div class="ant-space-item" style="margin-bottom: 0px;">
<section class="ant-layout">
<header class="ant-layout-header" style="text-align: center; color: rgb(255, 255, 255); padding-inline: 50; line-height: 64px; background-color: rgb(125, 188, 234);">Header</header>
<section class="ant-layout">
<main class="ant-layout-content" style="text-align: center; min-height: 120; line-height: 120px; color: rgb(255, 255, 255); background-color: rgb(16, 142, 233);">Content</main>
<aside style="text-align: center; line-height: 120px; color: rgb(255, 255, 255); background-color: rgb(59, 160, 233); flex: 0 0 200px; max-width: 200px; min-width: 200px; width: 200px;" class="ant-layout-sider ant-layout-sider-dark">
<div class="ant-layout-sider-children">Sider</div>
<!---->
</aside>
</section>
<footer class="ant-layout-footer" style="text-align: center; color: rgb(255, 255, 255); background-color: rgb(125, 188, 234);">Footer</footer>
</section>
</div>
<!---->
<div class="ant-space-item">
<section class="ant-layout">
<aside style="text-align: center; line-height: 120px; color: rgb(255, 255, 255); background-color: rgb(59, 160, 233); flex: 0 0 200px; max-width: 200px; min-width: 200px; width: 200px;" class="ant-layout-sider ant-layout-sider-dark">
<div class="ant-layout-sider-children">Sider</div>
<!---->
</aside>
<section class="ant-layout">
<header class="ant-layout-header" style="text-align: center; color: rgb(255, 255, 255); padding-inline: 50; line-height: 64px; background-color: rgb(125, 188, 234);">Header</header>
<main class="ant-layout-content" style="text-align: center; min-height: 120; line-height: 120px; color: rgb(255, 255, 255); background-color: rgb(16, 142, 233);">Content</main>
<footer class="ant-layout-footer" style="text-align: center; color: rgb(255, 255, 255); background-color: rgb(125, 188, 234);">Footer</footer>
</section>
</section>
</div>
<!---->
</div>
`;

exports[`renders ./components/layout/demo/custom-trigger.vue correctly 1`] = `
Expand Down
118 changes: 56 additions & 62 deletions components/layout/demo/basic.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,76 +16,70 @@ Classic page layouts.

</docs>
<template>
<a-layout>
<a-layout-header>Header</a-layout-header>
<a-layout-content>Content</a-layout-content>
<a-layout-footer>Footer</a-layout-footer>
</a-layout>
<a-space direction="vertical" :style="{ width: '100%' }" :size="[0, 48]">
<a-layout>
<a-layout-header :style="headerStyle">Header</a-layout-header>
<a-layout-content :style="contentStyle">Content</a-layout-content>
<a-layout-footer :style="footerStyle">Footer</a-layout-footer>
</a-layout>

<a-layout>
<a-layout-header>Header</a-layout-header>
<a-layout>
<a-layout-sider>Sider</a-layout-sider>
<a-layout-content>Content</a-layout-content>
<a-layout-header :style="headerStyle">Header</a-layout-header>
<a-layout>
<a-layout-sider :style="siderStyle">Sider</a-layout-sider>
<a-layout-content :style="contentStyle">Content</a-layout-content>
</a-layout>
<a-layout-footer :style="footerStyle">Footer</a-layout-footer>
</a-layout>
<a-layout-footer>Footer</a-layout-footer>
</a-layout>

<a-layout>
<a-layout-header>Header</a-layout-header>
<a-layout>
<a-layout-content>Content</a-layout-content>
<a-layout-sider>Sider</a-layout-sider>
<a-layout-header :style="headerStyle">Header</a-layout-header>
<a-layout>
<a-layout-content :style="contentStyle">Content</a-layout-content>
<a-layout-sider :style="siderStyle">Sider</a-layout-sider>
</a-layout>
<a-layout-footer :style="footerStyle">Footer</a-layout-footer>
</a-layout>
<a-layout-footer>Footer</a-layout-footer>
</a-layout>

<a-layout>
<a-layout-sider>Sider</a-layout-sider>
<a-layout>
<a-layout-header>Header</a-layout-header>
<a-layout-content>Content</a-layout-content>
<a-layout-footer>Footer</a-layout-footer>
<a-layout-sider :style="siderStyle">Sider</a-layout-sider>
<a-layout>
<a-layout-header :style="headerStyle">Header</a-layout-header>
<a-layout-content :style="contentStyle">Content</a-layout-content>
<a-layout-footer :style="footerStyle">Footer</a-layout-footer>
</a-layout>
</a-layout>
</a-layout>
</a-space>
</template>
<script lang="ts" setup>
import type { CSSProperties } from 'vue';
const headerStyle: CSSProperties = {
textAlign: 'center',
color: '#fff',
height: 64,
paddingInline: 50,
lineHeight: '64px',
backgroundColor: '#7dbcea',
};

const contentStyle: CSSProperties = {
textAlign: 'center',
minHeight: 120,
lineHeight: '120px',
color: '#fff',
backgroundColor: '#108ee9',
};

const siderStyle: CSSProperties = {
textAlign: 'center',
lineHeight: '120px',
color: '#fff',
backgroundColor: '#3ba0e9',
};

<style scoped>
#components-layout-demo-basic .code-box-demo {
text-align: center;
}
#components-layout-demo-basic .ant-layout-header,
#components-layout-demo-basic .ant-layout-footer {
color: #fff;
background: #7dbcea;
}
[data-theme='dark'] #components-layout-demo-basic .ant-layout-header {
background: #6aa0c7;
}
[data-theme='dark'] #components-layout-demo-basic .ant-layout-footer {
background: #6aa0c7;
}
#components-layout-demo-basic .ant-layout-footer {
line-height: 1.5;
}
#components-layout-demo-basic .ant-layout-sider {
color: #fff;
line-height: 120px;
background: #3ba0e9;
}
[data-theme='dark'] #components-layout-demo-basic .ant-layout-sider {
background: #3499ec;
}
#components-layout-demo-basic .ant-layout-content {
min-height: 120px;
color: #fff;
line-height: 120px;
background: rgba(16, 142, 233, 1);
}
[data-theme='dark'] #components-layout-demo-basic .ant-layout-content {
background: #107bcb;
}
#components-layout-demo-basic > .code-box-demo > .ant-layout + .ant-layout {
margin-top: 48px;
}
</style>
const footerStyle: CSSProperties = {
textAlign: 'center',
color: '#fff',
backgroundColor: '#7dbcea',
};
</script>
6 changes: 5 additions & 1 deletion components/space/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,11 @@ const Space = defineComponent({
const horizontalSizeVal = horizontalSize.value;
const latestIndex = len - 1;
return (
<div {...attrs} class={cn.value} style={[style.value, attrs.style as any]}>
<div
{...attrs}
class={[cn.value, attrs.class]}
style={[style.value, attrs.style as CSSProperties]}
>
{items.map((child, index) => {
const originIndex = children.indexOf(child);
let itemStyle: CSSProperties = {};
Expand Down
7 changes: 6 additions & 1 deletion components/steps/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import Tooltip from '../tooltip';
import { VcStepProps } from '../vc-steps/Step';
import type { Status, ProgressDotRender } from '../vc-steps/interface';
import type { MouseEventHandler } from '../_util/EventInterface';
import { useToken } from '../theme/internal';

// CSSINJS
import useStyle from './style';
Expand Down Expand Up @@ -66,6 +67,7 @@ const Steps = defineComponent({
const { prefixCls, direction: rtlDirection, configProvider } = useConfigInject('steps', props);
// style
const [wrapSSR, hashId] = useStyle(prefixCls);
const [, token] = useToken();

const screens = useBreakpoint();
const direction = computed(() =>
Expand All @@ -90,7 +92,10 @@ const Steps = defineComponent({
}) => {
if (status === 'process' && props.percent !== undefined) {
// currently it's hard-coded, since we can't easily read the actually width of icon
const progressWidth = props.size === 'small' ? 32 : 40;

const progressWidth =
props.size === 'small' ? token.value.controlHeight : token.value.controlHeightLG;

const iconWithProgress = (
<div class={`${prefixCls.value}-progress-icon`}>
<Progress
Expand Down
Loading