ISSUE-004 - Found the correct combination of CSS rules to get the centering I desire for both the div and img variants of the background image.
This commit is contained in:
1 parent
b4ea27e8c6
commit
f137b04e5e
3 files changed
+9
-13
No files matched your search
@@ -1,10 +1,9 @@
|
|||||||
import { VideoFeedFrame, BackgroundImage, BackgroundImageDiv } from "./styles";
|
import { VideoFeedFrame, BackgroundImageDiv } from "./styles";
|
||||||
|
|
||||||
import bg from "../../../public/images/misc/bg-standin.jpg";
|
import bg from "../../../public/images/misc/bg-standin.jpg";
|
||||||
|
|
||||||
export default function VideoFeed() {
|
export default function VideoFeed() {
|
||||||
return <VideoFeedFrame centered={true}>
|
return <VideoFeedFrame centered>
|
||||||
{/* <BackgroundImage src={bg} alt="formula one cars on track" /> */}
|
|
||||||
<BackgroundImageDiv src={bg} />
|
<BackgroundImageDiv src={bg} />
|
||||||
</VideoFeedFrame>;
|
</VideoFeedFrame>;
|
||||||
}
|
}
|
||||||
@@ -11,27 +11,23 @@ export const VideoFeedFrame = styled.div<VideoFeedFrameProps>`
|
|||||||
|
|
||||||
${({ centered = false }) => centered && css`
|
${({ centered = false }) => centered && css`
|
||||||
display: flex;
|
display: flex;
|
||||||
/* flex-direction: column; */
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
/* > * {
|
> div {
|
||||||
left: 10px;
|
background-position: center;
|
||||||
} */
|
}
|
||||||
`}
|
`}
|
||||||
`;
|
`;
|
||||||
VideoFeedFrame.displayName = "VideoFeedFrame";
|
VideoFeedFrame.displayName = "VideoFeedFrame";
|
||||||
|
|
||||||
export const BackgroundImage = styled.img`
|
export const BackgroundImage = styled.img`
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
max-width: 100%;
|
||||||
object-fit: contain;
|
object-fit: contain;
|
||||||
`;
|
`;
|
||||||
BackgroundImage.displayName = "BackgroundImage";
|
BackgroundImage.displayName = "BackgroundImage";
|
||||||
|
|
||||||
/**
|
|
||||||
* A slight improvement to using a simple img in that we can resize the image
|
|
||||||
* (the video) to shrink slightly in the video feed frame if the browser window
|
|
||||||
* is too narrow.
|
|
||||||
*/
|
|
||||||
type BackgroundImageDivProps = {
|
type BackgroundImageDivProps = {
|
||||||
src: string,
|
src: string,
|
||||||
}
|
}
|
||||||
@@ -41,5 +37,6 @@ export const BackgroundImageDiv = styled.div<BackgroundImageDivProps>`
|
|||||||
background-image: ${({ src }) => `url("${src}")`};
|
background-image: ${({ src }) => `url("${src}")`};
|
||||||
background-size: contain;
|
background-size: contain;
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
|
background-position: 0% 50%;
|
||||||
`;
|
`;
|
||||||
BackgroundImageDiv.displayName = "BackgroundImageDiv";
|
BackgroundImageDiv.displayName = "BackgroundImageDiv";
|
||||||
@@ -14,7 +14,7 @@ export default function Broadcast() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<FullScreenContainer minHeight={400} minWidth={600}>
|
<FullScreenContainer minHeight={700} minWidth={900}>
|
||||||
<RouteHeader ref={ref} title="Broadcast Page" />
|
<RouteHeader ref={ref} title="Broadcast Page" />
|
||||||
<Layout headerHeight={height} />
|
<Layout headerHeight={height} />
|
||||||
</FullScreenContainer>
|
</FullScreenContainer>
|
||||||
|
|||||||
Reference in new issue
Block a user