polished#directionalProperty JavaScript Examples
The following examples show how to use
polished#directionalProperty.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: list.js From Nextjs-ja-translation-docs with MIT License | 5 votes |
getRowRender = columnCount => ({ index, isScrolling, isVisible, key, parent, style }) => {
// let height = getRowHeight({index}, columnCount)
const content = [];
let highlighted = null;
let rowDir = 'row';
const startIndex = index * columnCount;
for (let i = 0; i < columnCount; ++i) {
const siteData = dataSource[startIndex + i];
if (!siteData) {
if (columnCount > 1) {
// push placeholder
content.push(<SitePreviewPlaceholder key={`site-${startIndex + i}`} />);
}
continue;
}
if (!highlighted && siteData.highlighted && columnCount === 3) {
highlighted = (
<SitePreview
highlighted
siteData={siteData}
flex={columnCount - 1}
isVisible={isVisible}
isScrolling={isScrolling}
isTablet={columnCount < 3}
key={`site-${siteData.internalUrl}`}
/>
);
rowDir = siteData.highlighted === 1 ? 'row' : 'row-reverse';
} else {
content.push(
<SitePreview
siteData={siteData}
isVisible={isVisible}
isScrolling={isScrolling}
isTablet={columnCount < 3}
key={`site-${siteData.internalUrl}`}
/>
);
}
}
return (
<div
key={`row-${index}`}
style={{
display: 'flex',
flexDirection: columnCount === 1 ? 'column' : rowDir,
...directionalProperty('padding', 0, GAP_X / 2),
...style
}}
>
{highlighted
? [
highlighted,
<div
key="column-normal"
style={{
display: 'flex',
flexDirection: 'column',
flex: 1
}}
>
{content}
</div>
]
: content}
</div>
);
}