Skip to content
This repository has been archived by the owner on Apr 25, 2024. It is now read-only.

Header check for data improved & better fix for the text issue #2

Merged
merged 2 commits into from
Nov 3, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions src/components/theme/Header/HeaderImage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,17 @@ function HeaderImage(props) {
const headerDimension = isBig ? 600 : 280;
const [contentCount, setContentCount] = React.useState(0);

const imageContent = document.getElementsByClassName('header-image-content');
const ccount = imageContent[0] ? imageContent[0].childElementCount : 0;
const imageContent =
nileshgulia1 marked this conversation as resolved.
Show resolved Hide resolved
typeof window !== 'undefined' && window.document
? window.document.getElementsByClassName('header-image-content')
: '';
const ccount =
imageContent && imageContent[0] ? imageContent[0].childElementCount : 0;

React.useEffect(() => {
setContentCount(ccount);
if (typeof window !== 'undefined') {
setContentCount(ccount);
}
}, [ccount]);

return props.url ? (
Expand Down