Skip to content

Commit

Permalink
refactor(buttons): centre-aligned
Browse files Browse the repository at this point in the history
  • Loading branch information
Kinplemelon authored and ysfscream committed Dec 27, 2024
1 parent 28d456e commit a77036f
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 10 deletions.
12 changes: 8 additions & 4 deletions src/components/Buttons/CreateButton.vue
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
<template>
<el-button type="primary" :icon="Plus">
<template v-if="!$slots.default">
{{ t('Base.create') }}
</template>
<el-button type="primary" :icon="Plus" v-if="noText"></el-button>
<el-button type="primary" :icon="Plus" v-else>
<template v-if="!$slots.default">{{ t('Base.create') }}</template>
<slot />
</el-button>
</template>

<script setup lang="ts">
import { Plus } from '@element-plus/icons-vue'
import { useI18n } from 'vue-i18n'
import { defineProps } from 'vue'
defineProps<{
noText?: boolean
}>()
const { t } = useI18n()
</script>
5 changes: 3 additions & 2 deletions src/components/Buttons/RefreshButton.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<template>
<el-button type="primary" :icon="Refresh">
<template v-if="!$slots.default && !noText">
<el-button type="primary" :icon="Refresh" v-if="noText"></el-button>
<el-button type="primary" :icon="Refresh" v-else>
<template v-if="!$slots.default">
{{ t('Base.refresh') }}
</template>
<slot />
Expand Down
5 changes: 3 additions & 2 deletions src/components/Buttons/SearchButton.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<template>
<el-button type="primary" plain :icon="Search">
<template v-if="!noText">{{ tl('search') }}</template>
<el-button type="primary" plain :icon="Search" v-if="noText"></el-button>
<el-button type="primary" plain :icon="Search" v-else>
<template>{{ tl('search') }}</template>
</el-button>
</template>

Expand Down
2 changes: 1 addition & 1 deletion src/views/Auth/components/AuthnManager.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<authn-users-import @uploadedData="loadData" />
</template>
<el-tooltip :content="$t('Base.add')" placement="top">
<CreateButton class="icon-button" @click="addCommand"><span /></CreateButton>
<CreateButton class="icon-button" @click="addCommand" no-text />
</el-tooltip>
</div>
</div>
Expand Down
4 changes: 3 additions & 1 deletion src/views/Auth/components/AuthzManager.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
</template>
</div>
<el-tooltip :content="$t('Base.add')" placement="top">
<CreateButton class="icon-button" @click="handleAdd"><span /></CreateButton>
<CreateButton class="icon-button" @click="handleAdd" >
<template v-if="false"></template>
</CreateButton>
</el-tooltip>
</div>
<el-table
Expand Down

0 comments on commit a77036f

Please sign in to comment.