routie dev init since i didn't adhere to any proper guidance up until now
This commit is contained in:
+34
@@ -0,0 +1,34 @@
|
||||
// Utilities
|
||||
import { computed } from 'vue';
|
||||
import { convertToUnit, propsFactory } from "../util/index.js"; // Types
|
||||
// Composables
|
||||
export const makeDimensionProps = propsFactory({
|
||||
height: [Number, String],
|
||||
maxHeight: [Number, String],
|
||||
maxWidth: [Number, String],
|
||||
minHeight: [Number, String],
|
||||
minWidth: [Number, String],
|
||||
width: [Number, String]
|
||||
}, 'dimension');
|
||||
export function useDimension(props) {
|
||||
const dimensionStyles = computed(() => {
|
||||
const styles = {};
|
||||
const height = convertToUnit(props.height);
|
||||
const maxHeight = convertToUnit(props.maxHeight);
|
||||
const maxWidth = convertToUnit(props.maxWidth);
|
||||
const minHeight = convertToUnit(props.minHeight);
|
||||
const minWidth = convertToUnit(props.minWidth);
|
||||
const width = convertToUnit(props.width);
|
||||
if (height != null) styles.height = height;
|
||||
if (maxHeight != null) styles.maxHeight = maxHeight;
|
||||
if (maxWidth != null) styles.maxWidth = maxWidth;
|
||||
if (minHeight != null) styles.minHeight = minHeight;
|
||||
if (minWidth != null) styles.minWidth = minWidth;
|
||||
if (width != null) styles.width = width;
|
||||
return styles;
|
||||
});
|
||||
return {
|
||||
dimensionStyles
|
||||
};
|
||||
}
|
||||
//# sourceMappingURL=dimensions.js.map
|
||||
Reference in New Issue
Block a user