Skip to content

Commit a64fa47

Browse files
Merge branch 'develop' into feature/screen-save-fix
2 parents a72f62a + 3902d0e commit a64fa47

File tree

4 files changed

+12
-3
lines changed

4 files changed

+12
-3
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ All notable changes to this project will be documented in this file.
99
- Fix save screen and go to list
1010
- Disable eslint for proptypes
1111
- Disable eslint for react in scope
12+
- [#284](https://github.com/os2display/display-admin-client/pull/284)
13+
- Fixed spacer calculations for previews.
14+
- Added border to preview container
1215
- [#283](https://github.com/os2display/display-admin-client/pull/283)
1316
- Fixed preview issues.
1417
- [#275](https://github.com/os2display/display-admin-client/pull/275)

src/components/preview/preview.jsx

+1
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ function Preview({
5757
width: `${width}px`,
5858
height: `${height}px`,
5959
overflow: "hidden",
60+
border: "1px solid #aaa",
6061
}}
6162
>
6263
<iframe

src/components/slide/preview/remote-component-wrapper.jsx

+7-3
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ function RemoteComponentWrapper({
3636
const [remoteComponentSlide, setRemoteComponentSlide] = useState(null);
3737
const [loading, err, Component] = useRemoteComponent(url);
3838
const [runId, setRunId] = useState("");
39-
const [fontSizeEm, setFontSizeEm] = useState(1);
39+
const [fontSizeRem, setFontSizeRem] = useState(1);
4040

4141
/** Create remoteComponentSlide from slide and mediaData */
4242
useEffect(() => {
@@ -90,7 +90,7 @@ function RemoteComponentWrapper({
9090
if (adjustFontSize) {
9191
if (entries.length > 0) {
9292
const first = entries[0];
93-
setFontSizeEm(
93+
setFontSizeRem(
9494
first.contentRect.width / (orientation === "vertical" ? 1080 : 1920)
9595
);
9696
}
@@ -109,7 +109,11 @@ function RemoteComponentWrapper({
109109
const remoteComponentStyle = {};
110110

111111
if (adjustFontSize) {
112-
remoteComponentStyle["--font-size-base"] = `${fontSizeEm}rem`;
112+
// These sizes relate to:
113+
// https://github.com/os2display/display-templates/blob/develop/src/global-styles.css#L100
114+
// https://github.com/os2display/display-templates/blob/develop/src/global-styles.css#L126
115+
remoteComponentStyle["--font-size-base"] = `${fontSizeRem}rem`;
116+
remoteComponentStyle["--spacer"] = `${fontSizeRem * 12}px`;
113117
}
114118

115119
return (

src/components/slide/preview/remote-component-wrapper.scss

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
.remote-component-wrapper {
22
width: 100%;
33
height: 100%;
4+
border: 1px solid #aaa;
45

56
.remote-component-content {
67
max-width: 100%;

0 commit comments

Comments
 (0)