Skip to content

Commit

Permalink
improve e-avatar
Browse files Browse the repository at this point in the history
  • Loading branch information
wd-4000 committed Sep 14, 2023
1 parent 571af79 commit 811ba65
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 20 deletions.
8 changes: 5 additions & 3 deletions src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export interface ModuleOptions {
};
borderRadius: string;
corePaddingX: string;
font: string;
font: {family: string, weight?: number};
}

const defaults: ModuleOptions = {
Expand All @@ -42,7 +42,7 @@ const defaults: ModuleOptions = {
},
borderRadius: "8px",
corePaddingX: "1rem",
font: "Roboto, sans-serif",
font: {family: "Roboto, sans-serif", weight: 400},
};

export default defineNuxtModule<ModuleOptions>({
Expand Down Expand Up @@ -77,7 +77,9 @@ export default defineNuxtModule<ModuleOptions>({
SCSSvariables += `$e-${key}-screen-breakpoint: ${value}; `;
}

CSSvariables += `--e-font-family: ${options.font}; `;
CSSvariables += `--e-font-family: ${options.font.family}; `;
CSSvariables += `--e-font-weight: ${options.font.weight}; `;

CSSvariables += `--e-rounded-border-radius: ${options.borderRadius}; `;
CSSvariables += `--e-core-padding-x: ${options.corePaddingX}; `;

Expand Down
23 changes: 6 additions & 17 deletions src/runtime/components/e/avatar.vue
Original file line number Diff line number Diff line change
@@ -1,31 +1,20 @@
<template>
<div class="flex-center a-container">
<slot />
<e-image-lazy-view
v-if="src"
class="avatar"
:width="size"
:height="size"
:contain="true"
:immediate-render="true"
:src="src"
border-radius="100%"
/>
<e-image-lazy-view v-if="src" class="avatar" :width="props.size" :height="props.size" :contain="true"
:immediate-render="true" :src="src" border-radius="100%" />
<div v-else>
<e-icon
:size="size"
:icon="mdiAccountCircle"
/>
<e-icon :size="props.size" :icon="mdiAccountCircle" />
</div>
</div>
</template>
<script setup lang="ts">
import { mdiAccountCircle } from "@mdi/js";
const size = 120;
defineProps<{
const props = withDefaults(defineProps<{
src?: string;
}>();
size?: number;
}>(), { size: 120 });
</script>
<style lang="scss" scoped>
.avatar {
Expand Down
2 changes: 2 additions & 0 deletions src/runtime/css/util.scss
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ body {
background-color: var(--e-color-light);
color: var(--e-color-dark);
font-family: var(--e-font-family);
font-weight: var(--e-font-weight);

}

.fullheight {
Expand Down

0 comments on commit 811ba65

Please sign in to comment.