Skip to content

Commit

Permalink
feat: clip modal self-adaption(#174)
Browse files Browse the repository at this point in the history
  • Loading branch information
imzbf committed Nov 16, 2022
1 parent 460aa40 commit 842edd9
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
8 changes: 7 additions & 1 deletion MdEditor/components/Modal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ const modalProps = () => ({
onAdjust: {
type: Function as PropType<(val: boolean) => void>,
default: () => () => {}
},
class: {
type: String as PropType<string>
}
});

Expand Down Expand Up @@ -155,7 +158,10 @@ export default defineComponent({
const slotTitle = getSlot({ props, ctx }, 'title');

return (
<div style={{ display: modalVisible.value ? 'block' : 'none' }}>
<div
class={[props.class]}
style={{ display: modalVisible.value ? 'block' : 'none' }}
>
<div class={`${prefix}-modal-mask`} onClick={props.onClose} />
<div
class={modalClass.value}
Expand Down
1 change: 1 addition & 0 deletions MdEditor/layouts/Modals/Clip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ export default defineComponent({

return () => (
<Modal
class={`${prefix}-modal-clip`}
title={ult.value.clipModalTips?.title}
visible={props.visible}
onClose={props.onCancel}
Expand Down
26 changes: 26 additions & 0 deletions MdEditor/layouts/Modals/style.less
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,29 @@
}
}
}

@media (max-width: 688px) {
.@{prefix}-modal-clip {
.@{prefix}-modal {
max-width: calc(100% - 20px);
max-height: calc(100% - 20px);
margin: 10px;
left: 0 !important;
}

.@{prefix}-clip {
flex-direction: column;

&-main,
&-preview {
width: 100%;
height: 0;
flex: 1;
}

&-main {
margin-bottom: 1em;
}
}
}
}

0 comments on commit 842edd9

Please sign in to comment.