Skip to content

Commit

Permalink
PATCH: feat: add backgroundColor prop to bimdata-model-preview
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasRichel committed Aug 3, 2022
1 parent dd5473a commit f39a8fb
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
<component
:is="previewComponent"
class="bimdata-model-preview"
:style="{ width: `${width}px`, height: `${height}px` }"
:style="{
width: `${width}px`,
height: `${height}px`,
backgroundColor,
}"
v-bind="$props"
/>
</template>
Expand Down Expand Up @@ -36,6 +40,10 @@ export default {
defaultUrl: {
type: String,
},
backgroundColor: {
type: String,
default: "var(--color-silver-light)",
},
},
computed: {
previewComponent() {
Expand Down
1 change: 0 additions & 1 deletion src/BIMDataComponents/BIMDataModelPreview/Preview2D.vue
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ export default {
.preview-2d {
position: relative;
height: 100%;
background-color: var(--color-silver-light);
user-select: none;
overflow: hidden;
Expand Down
1 change: 0 additions & 1 deletion src/BIMDataComponents/BIMDataModelPreview/Preview3D.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ export default {

<style scoped lang="scss">
.preview-3d {
background-color: var(--color-silver-light);
user-select: none;
.viewport {
Expand Down
13 changes: 11 additions & 2 deletions src/web/views/Components/ModelPreview/ModelPreview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
<ComponentCode :componentTitle="$route.name" language="javascript">
<template #module>
<BIMDataModelPreview
:type="type"
:width="width"
:height="height"
:type="type"
:backgroundColor="bgColor"
:previewUrl="imgUrl"
/>
</template>
Expand All @@ -34,6 +35,12 @@
placeholder="Preview height (in px)"
v-model="height"
/>
<BIMDataInput
margin="24px 0"
type="text"
placeholder="Background color"
v-model="bgColor"
/>
</template>

<template #import>
Expand All @@ -47,6 +54,7 @@
:type="{{ type }}"
:width="{{ width }}"
:height="{{ height }}"
:backgroundColor="{{ bgColor }}"
:previewUrl="{{ imgUrl }}"
/&gt;
</pre>
Expand Down Expand Up @@ -90,9 +98,10 @@ export default {
data() {
return {
// Parameters
type: "3d",
width: 300,
height: 300,
type: "3d",
bgColor: "var(--color-silver-light)",
// Data
propsData,
};
Expand Down
6 changes: 6 additions & 0 deletions src/web/views/Components/ModelPreview/props-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,11 @@ export default [
"String",
"",
"Image that will be displayed if no preview url is provided"
],
[
"backgroundColor",
"String",
"",
"Preview 'background-color' CSS property"
]
];

0 comments on commit f39a8fb

Please sign in to comment.