Skip to content

Commit

Permalink
feat(calendar): adjust card calendar panel size (Tencent#1863)
Browse files Browse the repository at this point in the history
  • Loading branch information
uyarn authored Nov 30, 2022
1 parent c434d44 commit 73c8c71
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 19 deletions.
6 changes: 3 additions & 3 deletions src/calendar/__tests__/__snapshots__/index.test.jsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -15409,7 +15409,7 @@ exports[`Calendar > :props > :theme 1`] = `
class="t-input__wrap t-select"
>
<div
class="t-input t-size-m t-is-default t-is-readonly t-input--auto-width t-input--prefix t-input--suffix"
class="t-input t-size-s t-is-default t-is-readonly t-input--auto-width t-input--prefix t-input--suffix"
>
<div
class="t-input__prefix"
Expand Down Expand Up @@ -15460,7 +15460,7 @@ exports[`Calendar > :props > :theme 1`] = `
class="t-input__wrap t-select"
>
<div
class="t-input t-size-m t-is-default t-is-readonly t-input--auto-width t-input--prefix t-input--suffix"
class="t-input t-size-s t-is-default t-is-readonly t-input--auto-width t-input--prefix t-input--suffix"
>
<div
class="t-input__prefix"
Expand Down Expand Up @@ -15506,7 +15506,7 @@ exports[`Calendar > :props > :theme 1`] = `
style="height: auto;"
>
<div
class="t-radio-group t-size-m t-radio-group--filled"
class="t-radio-group t-size-s t-radio-group--filled"
>
<label
class="t-radio-button t-is-checked"
Expand Down
13 changes: 4 additions & 9 deletions src/calendar/_example/card.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,16 @@
<t-space direction="vertical" size="large">
<t-space size="small" align="center">
<label>请选择风格:</label>
<t-select v-model="theme" class="demo-select-base">
<t-select v-model="theme">
<t-option v-for="item in options" :key="item.value" :value="item.value" :label="item.label" />
</t-select>
<t-button theme="primary" @click="toCurrent()">今天(当前高亮日期)</t-button>
<t-button theme="primary" @click="toCurrent()"> 今天(当前高亮日期) </t-button>
</t-space>
<div>
<label>日期补零:</label>
<t-switch size="large" v-model="fillWithZero"></t-switch>
<t-switch v-model="fillWithZero" size="large" />
</div>
<t-calendar
ref="myCalendar"
:theme="theme"
:isShowWeekendDefault="isShowWeekendDefault"
:fillWithZero="fillWithZero"
></t-calendar>
<t-calendar ref="myCalendar" :theme="theme" :is-show-weekend-default="true" :fill-with-zero="fillWithZero" />
</t-space>
</template>

Expand Down
7 changes: 5 additions & 2 deletions src/calendar/_example/cell-append.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@
<t-calendar>
<template slot="cellAppend" slot-scope="data">
<div v-if="getShow(data)" class="cell-append-demo-outer">
<t-tag theme="primary" size="small" class="activeTag">
{{ data.mode == 'month' ? '今天' : '本月' }}
<t-tag theme="success" variant="light" size="small" class="activeTag" style="width: 100%">
{{ data.mode == 'month' ? '我们的纪念日' : '我们的纪念月' }}
</t-tag>
<t-tag theme="warning" variant="light" size="small" class="activeTag" style="width: 100%">
{{ data.mode == 'month' ? '家庭聚会' : '家庭聚会' }}
</t-tag>
</div>
</template>
Expand Down
8 changes: 4 additions & 4 deletions src/calendar/_example/cell.vue
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export default {
position: relative;
display: flex;
align-items: center;
color: rgba(0, 0, 0, 0.6);
color: var(--td-text-color-secondary);
span {
display: block;
left: 1px;
Expand All @@ -86,13 +86,13 @@ export default {
}
}
.error {
background: #e34d59;
background: var(--td-error-color);
}
.warning {
background: #ed7b2f;
background: var(--td-warning-color);
}
.success {
background: #00a870;
background: var(--td-success-color);
}
.slotWrapper {
Expand Down
7 changes: 7 additions & 0 deletions src/calendar/calendar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,13 @@ export default mixins(getConfigReceiverMixins<Vue, CalendarConfig>('calendar')).
isControllerVisible() {
this.handleIE();
},
theme: {
handler(v: TdCalendarProps['theme']) {
if (v === 'card') this.controlSize = 'small';
if (v === 'full') this.controlSize = 'medium';
},
immediate: true,
},
},
mounted() {
this.handleIE();
Expand Down

0 comments on commit 73c8c71

Please sign in to comment.