Skip to content

Commit

Permalink
Merge pull request #640 from SUI-Components/feat/content-visibility
Browse files Browse the repository at this point in the history
feat(components/perf/dynamicRendering): add content-visibility property
  • Loading branch information
nucliweb authored Nov 30, 2023
2 parents 9c6b537 + 908e20b commit 6b3f63b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 5 additions & 7 deletions components/perf/dynamicRendering/src/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import PropTypes from 'prop-types'

import LazyContent from './lazyContent'
import LazyContent from './lazyContent.js'

import './index.scss'

const BOTS_USER_AGENTS = [
'googlebot',
Expand Down Expand Up @@ -40,19 +42,15 @@ export default function PerfDynamicRendering({
// so check if we're on the browser side and if is not disabled the component
if (isOnBrowser && !disabled) {
return (
<LazyContent
rootMargin={rootMargin}
placeholder={placeholder}
height={height}
>
<LazyContent rootMargin={rootMargin} placeholder={placeholder} height={height}>
{children}
</LazyContent>
)
} else if (placeholder) {
// so, we're on the server side or the component is disabled
return placeholder
} else {
return <div style={{height: `${height}px`, marginBottom: '1px'}} />
return <div style={{containIntrinsicSize: `auto ${height}px`, height: `${height}px`, marginBottom: '1px'}} />
}
}

Expand Down
4 changes: 3 additions & 1 deletion components/perf/dynamicRendering/src/index.scss
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
// EMPTY. Keep to get studio working as expected
.sui-PerfDynamicRendering-placeholder {
content-visibility: auto;
}

0 comments on commit 6b3f63b

Please sign in to comment.