Skip to content

Commit

Permalink
refactor(Textarea): new textarea (#523)
Browse files Browse the repository at this point in the history
* refactor(Textarea): new textarea

* test: update snapshots

* fix: fix cr
  • Loading branch information
anlyyao authored Mar 24, 2023
1 parent c2ea9ab commit 1990ec2
Show file tree
Hide file tree
Showing 72 changed files with 40,938 additions and 38,894 deletions.
38 changes: 34 additions & 4 deletions site/mobile/components/demo-block.vue
Original file line number Diff line number Diff line change
@@ -1,13 +1,43 @@
<template>
<div class="tdesign-mobile-demo-block">
<h2 v-if="title" class="tdesign-mobile-demo-block__title">{{ title }}</h2>
<p v-if="summary" class="tdesign-mobile-demo-block__summary">{{ summary }}</p>
<slot></slot>
<div :class="rootClassName">
<div v-if="title || summary" class="tdesign-mobile-demo-block__header">
<h2 v-if="title" class="tdesign-mobile-demo-block__title">{{ title }}</h2>
<p v-if="summary" :class="summaryClassName">
{{ summary }}
</p>
</div>
<div :class="slotClassName">
<slot />
</div>
</div>
</template>
<script lang="ts" setup>
import { computed } from 'vue';
const props = defineProps<{
title?: String;
summary?: String;
padding?: Boolean;
}>();
const rootClassName = computed(() => [
'tdesign-mobile-demo-block',
{
['tdesign-mobile-demo-block_notitle']: !!props.title,
},
]);
const summaryClassName = computed(() => [
`tdesign-mobile-demo-block__summary`,
{
['tdesign-mobile-demo-block_subtitle']: !!props.title,
},
]);
const slotClassName = computed(() => [
`tdesign-mobile-demo-block__slot`,
{
['with-padding']: props.padding,
},
]);
</script>
58 changes: 37 additions & 21 deletions site/styles/mobile/demo.less
Original file line number Diff line number Diff line change
@@ -1,43 +1,59 @@
.tdesign-mobile-demo {
background-color: #F6F6F6;
background-color: #f6f6f6;
font-family: "PingFang SC";
padding-bottom: 28px;

.title {
padding: 24px 16px 8px 16px;
opacity: 1;
color: rgba(0, 0, 0, 0.9);
font-size: 20px;
font-size: 24px;
font-weight: 700;
line-height: 28px;
line-height: 32px;
margin: 24px 16px 0;
color: rgba(0, 0, 0, .9);
}

.summary {
opacity: 1;
color: rgba(0, 0, 0, 0.4);
font-size: 12px;
font-size: 14px;
color: rgba(0, 0, 0, 0.6);
margin: 8px 16px 0;
line-height: 22px;
padding: 0 16px;
}

&-block {
width: 100%;
margin: 32px 0 0;

&__title {
padding: 24px 16px 0;
font-size: 16px;
font-weight: 700;
&__header {
color: #000;
margin: 0 16px;
}

&__title + &__summary {
padding: 8px 16px 16px;
&__title {
font-weight: 700;
font-size: 18px;
line-height: 26px;
}

&__summary {
opacity: 1;
color: rgba(0, 0, 0, 0.4);
font-size: 12px;
margin-top: 8px;
font-size: 14px;
white-space: pre-line;
color: rgba(0, 0, 0, 0.6);
line-height: 22px;
padding: 16px;
}

&__slot {
margin-top: 16px;

&.with-padding {
margin: 16px 16px 0;
}
}
}
}

.tdesign-mobile-demo-block_notitle {
margin-top: 0px;

.tdesign-mobile-demo-block_subtitle {
margin-top: 24px;
}
}
2 changes: 1 addition & 1 deletion src/_common
Loading

0 comments on commit 1990ec2

Please sign in to comment.