Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion docs/examples/logicalProperties.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const Demo = () => {
border: '1px solid #000',
position: 'relative',
// css logical-properties
paddingInline: 10,
paddingInline: 'calc(10px - 2px)',
borderBlockEndWidth: 3,
marginBlock: 10,
borderEndEndRadius: '50%',
Expand Down
12 changes: 6 additions & 6 deletions src/transformers/legacyLogicalProperties.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,22 @@ function splitValues(
.split(/\s+/);

// Combine styles split in brackets, like `calc(1px + 2px)`
let temp = '';
let temp: string[] = [];
let brackets = 0;
return [
splitStyle.reduce<string[]>((list, item) => {
if (item.includes('(')) {
temp += item;
temp.push(item);
brackets += item.split('(').length - 1;
} else if (item.includes(')')) {
temp += item;
temp.push(item);
brackets -= item.split(')').length - 1;
if (brackets === 0) {
list.push(temp);
temp = '';
list.push(temp.join(' '));
temp = [];
}
} else if (brackets > 0) {
temp += item;
temp.push(item);
} else {
list.push(item);
}
Expand Down