Skip to content

πŸ”₯ πŸ”₯ πŸ”₯ A Free & Self-hostable Airtable Alternative

fix(nc-gui): uniform buttons in expanded form

Ramesh Manec3cda52045e9
diff --git a/packages/nc-gui/components/cell/AI.vue b/packages/nc-gui/components/cell/AI.vue
index d1acd7d3d6..6b13c6f955 100644
--- a/packages/nc-gui/components/cell/AI.vue
+++ b/packages/nc-gui/components/cell/AI.vue
@@ -132,11 +132,24 @@ const isDisabledAiButton = computed(() => {
<template #title>
{{ aiIntegrations.length ? $t('tooltip.aiIntegrationReConfigure') : $t('tooltip.aiIntegrationAddAndReConfigure') }}
</template>
- <button class="nc-cell-ai-button nc-cell-button h-6" size="small" :disabled="isDisabledAiButton" @click.stop="generate">
+ <button
+ class="nc-cell-ai-button nc-cell-button"
+ :class="{
+ 'is-expanded-form': isExpandedForm,
+ }"
+ size="small"
+ :disabled="isDisabledAiButton"
+ @click.stop="generate"
+ >
<div class="flex items-center gap-1">
<GeneralLoader v-if="isLoading" size="regular" />
<GeneralIcon v-else icon="ncAutoAwesome" class="h-4 w-4" />
- <span class="text-small leading-[18px] truncate font-medium">Generate</span>
+ <span
+ class="leading-[18px] truncate"
+ :class="{ 'text-sm font-semibold': isExpandedForm, 'text-small font-medium': !isExpandedForm }"
+ >
+ Generate
+ </span>
</div>
</button>
</NcTooltip>
@@ -157,7 +170,7 @@ const isDisabledAiButton = computed(() => {
<style scoped lang="scss">
.nc-cell-button {
- @apply rounded-md px-2 flex items-center gap-2 transition-all justify-center bg-nc-bg-purple-dark hover:bg-nc-purple-200 text-nc-content-gray-subtle;
+ @apply px-2 flex items-center gap-2 transition-all justify-center bg-nc-bg-purple-dark hover:bg-nc-purple-200 text-nc-content-gray-subtle;
box-shadow: 0px 3px 1px -2px rgba(0, 0, 0, 0.06), 0px 5px 3px -2px rgba(0, 0, 0, 0.02);
@@ -165,6 +178,14 @@ const isDisabledAiButton = computed(() => {
@apply !text-nc-content-purple-dark;
}
+ &.is-expanded-form {
+ @apply h-8 rounded-lg my-1;
+ }
+
+ &:not(.is-expanded-form) {
+ @apply h-6 rounded-md;
+ }
+
&:focus-within {
@apply outline-none ring-0;
box-shadow: 0px 0px 0px 2px var(--nc-bg-default), 0px 0px 0px 4px var(--color-purple-500);
diff --git a/packages/nc-gui/components/cell/attachment/index.vue b/packages/nc-gui/components/cell/attachment/index.vue
index 6efc9fe066..1117ea7a08 100644
--- a/packages/nc-gui/components/cell/attachment/index.vue
+++ b/packages/nc-gui/components/cell/attachment/index.vue
@@ -545,6 +545,11 @@ onUnmounted(() => {
}
}
+ &:has(.nc-cell-ai-button.is-expanded-form),
+ &:has(.nc-cell-button.is-expanded-form) {
+ @apply -mt-1 -ml-1;
+ }
+
.nc-cell-attachment {
@apply !border-none;
}
diff --git a/packages/nc-gui/components/virtual-cell/Button.vue b/packages/nc-gui/components/virtual-cell/Button.vue
index 2219e264ba..f152bacf3c 100644
--- a/packages/nc-gui/components/virtual-cell/Button.vue
+++ b/packages/nc-gui/components/virtual-cell/Button.vue
@@ -267,9 +267,9 @@ const triggerAction = async () => {
data-testid="nc-button-cell"
:class="[
`${column.colOptions.color ?? 'brand'} ${column.colOptions.theme ?? 'solid'}`,
- { '!w-6': !column.colOptions.label, 'disabled': componentProps.disabled },
+ { '!w-6': !column.colOptions.label, 'disabled': componentProps.disabled, 'is-expanded-form': isExpandedForm },
]"
- class="nc-cell-button nc-button-cell-link btn-cell-colors truncate flex items-center h-6"
+ class="nc-cell-button nc-button-cell-link btn-cell-colors truncate flex items-center"
@click.prevent="triggerAction"
>
<GeneralIcon
@@ -288,7 +288,7 @@ const triggerAction = async () => {
/>
<GeneralIcon v-else-if="column.colOptions.icon" :icon="column.colOptions.icon" class="!w-4 min-w-4 min-h-4 !h-4" />
<NcTooltip v-if="column.colOptions.label" class="!truncate" show-on-truncate-only>
- <span class="text-[13px] truncate font-medium">
+ <span class="truncate" :class="{ 'text-sm font-semibold': isExpandedForm, 'text-[13px] font-medium': !isExpandedForm }">
{{ column.colOptions.label }}
</span>
<template #title>
@@ -323,17 +323,25 @@ const triggerAction = async () => {
<style scoped lang="scss">
.nc-cell-button {
- @apply rounded-md px-2 flex items-center gap-2 transition-all justify-center;
+ @apply px-2 flex items-center gap-2 transition-all justify-center;
&:not([class*='text']) {
box-shadow: 0px 3px 1px -2px rgba(0, 0, 0, 0.06), 0px 5px 3px -2px rgba(0, 0, 0, 0.02);
}
&:focus-within {
@apply outline-none ring-0;
- box-shadow: 0px 0px 0px 2px #fff, 0px 0px 0px 4px #3069fe;
+ box-shadow: 0px 0px 0px 2px var(--nc-bg-default), 0px 0px 0px 4px #3069fe;
}
&[disabled] {
@apply opacity-50;
}
+
+ &.is-expanded-form {
+ @apply h-8 rounded-lg my-1;
+ }
+
+ &:not(.is-expanded-form) {
+ @apply h-6 rounded-md;
+ }
}
.btn-cell-colors {