Skip to content

Commit

Permalink
style(projects): perf layout card style
Browse files Browse the repository at this point in the history
  • Loading branch information
honghuangdc committed Nov 11, 2023
1 parent 93f1806 commit fc409db
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
20 changes: 16 additions & 4 deletions src/components/custom/button-icon.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,26 @@ interface Props {
}
const props = withDefaults(defineProps<Props>(), {
class: '',
class: 'h-36px text-icon',
icon: '',
tooltipContent: '',
tooltipPlacement: 'bottom',
triggerParent: false
});
const cls = computed(() => props.class);
const cls = computed(() => {
let clsStr = props.class;
if (!clsStr.includes('h-')) {
clsStr += ' h-36px';
}
if (!clsStr.includes('text-')) {
clsStr += ' text-icon';
}
return clsStr;
});
function getPopupContainer(triggerNode: HTMLElement) {
return props.triggerParent ? triggerNode.parentElement! : document.body;
Expand All @@ -51,15 +63,15 @@ function getPopupContainer(triggerNode: HTMLElement) {
:get-popup-container="getPopupContainer"
:title="tooltipContent"
>
<AButton type="text" class="h-36px text-icon" :class="cls">
<AButton type="text" :class="cls">
<div class="flex-center gap-8px">
<slot>
<SvgIcon :icon="icon" />
</slot>
</div>
</AButton>
</ATooltip>
<AButton v-else type="text" class="h-36px text-icon" :class="cls">
<AButton v-else type="text" :class="cls">
<div class="flex-center gap-8px">
<slot>
<SvgIcon :icon="icon" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ function handleChangeMode(mode: UnionKey.ThemeLayoutMode) {
>
<ATooltip :placement="item.placement" :title="$t(themeLayoutModeRecord[mode])">
<div
class="layout-card__shadow gap-6px w-96px h-64px p-6px rd-4px"
class="gap-6px w-96px h-64px p-6px rd-4px shadow dark:shadow-coolGray-5"
:class="[key.includes('vertical') ? 'flex' : 'flex-vertical']"
>
<slot :name="key"></slot>
Expand All @@ -88,8 +88,4 @@ function handleChangeMode(mode: UnionKey.ThemeLayoutMode) {
</div>
</template>

<style scoped>
.layout-card__shadow {
box-shadow: 0 1px 2.5px rgba(0, 0, 0, 0.18);
}
</style>
<style scoped></style>

0 comments on commit fc409db

Please sign in to comment.