Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(comp:modal): add padding to padding next icon #701

Merged
merged 2 commits into from
Jan 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ describe('Footer', () => {
await wrapper.setProps({ okButton: undefined })

expect(wrapper.find('.ix-button').classes()).not.toContain('ix-button-dashed')
expect(wrapper.find('.ix-button').classes()).toContain('ix-button-primary')
})

test('okLoading work', async () => {
Expand Down
30 changes: 15 additions & 15 deletions packages/components/_private/footer/src/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,6 @@ import { footerProps } from './types'
export default defineComponent({
props: footerProps,
setup(props, { slots }) {
const okButtonProps = computed<FooterButtonProps | undefined>(() => {
const { ok, okButton, okLoading, okText } = props
if (!ok && !okText && !okButton) {
return undefined
}
return {
key: '__IDUX_FOOTER_BUTTON_OK',
text: okText,
onClick: ok,
loading: okLoading,
mode: 'primary',
...okButton,
}
})

const cancelButtonProps = computed<FooterButtonProps | undefined>(() => {
const { cancel, cancelButton, cancelVisible, cancelLoading, cancelText } = props
if (!cancelVisible || (!cancel && !cancelText && !cancelButton)) {
Expand All @@ -46,6 +31,21 @@ export default defineComponent({
}
})

const okButtonProps = computed<FooterButtonProps | undefined>(() => {
const { ok, okButton, okLoading, okText } = props
if (!ok && !okText && !okButton) {
return undefined
}
return {
key: '__IDUX_FOOTER_BUTTON_OK',
text: okText,
onClick: ok,
loading: okLoading,
mode: cancelButtonProps.value ? 'primary' : 'default',
...okButton,
}
})

return () => {
const footerProp = props.footer
const footerSlot = slots.footer
Expand Down
7 changes: 5 additions & 2 deletions packages/components/empty/style/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@
.reset-component();

text-align: center;
font-size: @empty-font-size;
line-height: @empty-line-height;
margin: @empty-margin;
color: @empty-color;

&-image {
margin-bottom: @empty-image-margin-bottom;
Expand All @@ -19,15 +17,20 @@
.@{icon-prefix} {
opacity: @empty-image-icon-opacity;
font-size: @empty-image-icon-font-size;
color: @empty-image-icon-color;
}
}

&-description {
opacity: @empty-description-opacity;
margin: @empty-description-margin;
color: @empty-description-color;
font-size: @empty-description-font-size;
}

&-content {
margin-top: @empty-content-margin-top;
color: @empty-content-color;
font-size: @empty-content-font-size;
}
}
7 changes: 5 additions & 2 deletions packages/components/empty/style/themes/default.variable.less
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
@empty-font-size: @font-size-md;
@empty-line-height: @line-height-base;
@empty-margin: @spacing-lg 0;
@empty-color: @text-color;

@empty-image-margin-bottom: @spacing-sm;
@empty-image-icon-opacity: 0.3;
@empty-image-icon-font-size: 64px;
@empty-image-icon-color: @text-color;

@empty-description-opacity: 0.6;
@empty-description-margin: 0;
@empty-description-color: @text-color;
@empty-description-font-size: @font-size-md;

@empty-content-margin-top: @spacing-lg;
@empty-content-color: @text-color;
@empty-content-font-size: @font-size-md;
2 changes: 1 addition & 1 deletion packages/components/i18n/src/locales/zh-CN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const zhCN: Locale = {
modal: {
cancelText: '取消',
okText: '确定',
justOkText: '知道了',
justOkText: '我知道了',
},
popconfirm: {
cancelText: '取消',
Expand Down
19 changes: 5 additions & 14 deletions packages/components/modal/src/ModalWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,21 @@
* found in the LICENSE file at https://github.com/IDuxFE/idux/blob/main/LICENSE
*/

import {
ComputedRef,
Ref,
Transition,
computed,
defineComponent,
inject,
onBeforeUnmount,
onMounted,
ref,
watch,
} from 'vue'
import type { ModalProps } from './types'
import type { ModalConfig } from '@idux/components/config'
import type { ComputedRef, Ref } from 'vue'

import { Transition, computed, defineComponent, inject, onBeforeUnmount, onMounted, ref, watch } from 'vue'

import { isFunction } from 'lodash-es'

import { callEmit, convertCssPixel, getOffset } from '@idux/cdk/utils'
import { ɵFooter } from '@idux/components/_private/footer'
import { ɵHeader } from '@idux/components/_private/header'
import { ModalConfig } from '@idux/components/config'
import { getLocale } from '@idux/components/i18n'

import ModalBody from './ModalBody'
import { MODAL_TOKEN, modalToken } from './token'
import { ModalProps } from './types'

export default defineComponent({
inheritAttrs: false,
Expand Down
6 changes: 5 additions & 1 deletion packages/components/modal/style/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,14 @@
font-size: @modal-body-title-font-size;
font-weight: @modal-body-title-font-weight;
margin-bottom: @modal-body-title-margin-bottom;
color: @modal-body-title-color;
}

&-content {
width: 100%;
padding: @modal-body-content-padding;
font-size: @modal-body-content-font-size;
color: @modal-body-content-color;
}

&-confirm,
Expand All @@ -65,7 +69,7 @@
&-warning,
&-error {
display: flex;
padding-top: 0;
padding: @modal-body-typed-padding;
}

&-icon {
Expand Down
9 changes: 9 additions & 0 deletions packages/components/modal/style/themes/default.variable.less
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,22 @@
@modal-body-title-font-size: @font-size-lg;
@modal-body-title-font-weight: @font-weight-xl;
@modal-body-title-margin-bottom: @spacing-sm;
@modal-body-title-color: @text-color;

@modal-body-content-font-size: @modal-font-size;
@modal-body-content-color: @text-color;
@modal-body-content-padding: 0;

@modal-body-icon-font-size: 48px;
@modal-body-icon-margin: 0 @spacing-lg;

@modal-body-confirm-color: @color-warning;
@modal-body-info-color: @color-info;
@modal-body-success-color: @color-success;
@modal-body-warning-color: @color-warning;
@modal-body-error-color: @color-error;

@modal-body-typed-padding: 0 @spacing-sm @spacing-xl;

@modal-max-width-screen-sm: calc(100vw - 16px);
@modal-margin-screen-sm: @spacing-sm auto;