zmp-vue
Version:
Build full featured iOS & Android apps using ZMP & Vue
55 lines (51 loc) • 1.6 kB
JavaScript
import { renderSlot as _renderSlot, openBlock as _openBlock, createBlock as _createBlock } from "vue";
function render(_ctx, _cache) {
return _openBlock(), _createBlock("p", {
class: _ctx.classes,
style: _ctx.styles
}, [_renderSlot(_ctx.$slots, "default")], 6);
}
import { computed } from 'vue';
import { classNames } from '../shared/utils';
import { FONT_SIZE_LINE_HEIGHT_MAP } from '../../common/constants';
export default {
name: 'zmp-box',
render: render,
props: {
size: String,
bold: Boolean,
fontSize: [String, Number],
noSpace: Boolean
},
setup: function setup(props) {
var classes = computed(function () {
return classNames('typo-body', {
'typo-body-bold': props.bold,
'typo-body-xxxsmall': props.size === 'xxxsmall',
'typo-body-xxsmall': props.size === 'xxsmall',
'typo-body-xsmall': props.size === 'xsmall',
'typo-body-small': props.size === 'small',
'typo-body-normal': !props.size || props.size === 'normal',
'typo-body-large': props.size === 'large',
'typo-body-xlarge': props.size === 'xlarge',
'typo-body-no-spacing': props.noSpacing
});
});
var styles = computed(function () {
if (!props.size && props.fontSize) {
var lineHeight = FONT_SIZE_LINE_HEIGHT_MAP[props.fontSize];
if (lineHeight) {
return {
fontSize: props.fontSize + "px",
lineHeight: lineHeight + "px"
};
}
}
return {};
});
return {
classes: classes,
styles: styles
};
}
};