Skip to content

Commit 2defeb6

Browse files
committed
fix: border bug
1 parent 9124b53 commit 2defeb6

File tree

4 files changed

+14
-30
lines changed

4 files changed

+14
-30
lines changed

npm/CssToTailwindTranslator.ts

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -455,18 +455,14 @@ const propertyMap: Map<string, Record<string, string> | ((val: string) => string
455455
'border',
456456
val => {
457457
val = val.replace(/\(.+?\)/, v => v.replace(/\s/g, ''))
458-
const vals: string = val.split(' ').filter(v => v !== '').map(v => (isUnit(v) || isColor(v)) ? ({ 'transparent': 'border-transparent', 'currentColor': 'border-current', 'currentcolor': 'border-current' }[val] ?? `border-[${v}]`) : ((propertyMap.get('border-style') as Record<string, string>)[v] ?? '')).filter(v => v !== '').join(' ')
458+
const vals: string = val.split(' ').filter(v => v !== '').map(v => (isUnit(v) || isColor(v)) ? ({ 'transparent': 'border-transparent', 'currentColor': 'border-current', 'currentcolor': 'border-current' }[val] ?? (propertyMap.get('border-style') as Record<string, string>)[v] ?? `border-[${v}]`) : ((propertyMap.get('border-style') as Record<string, string>)[v] ?? '')).filter(v => v !== '').join(' ')
459459
return vals
460460
}
461461
],
462462
[
463463
'border-bottom',
464464
val => {
465-
if (isUnit(val)) {
466-
return `border-b-[${getCustomVal(val)}]`
467-
} else {
468-
return `[border-bottom:${getCustomVal(val)}]`
469-
}
465+
return `[border-bottom:${getCustomVal(val)}]`
470466
}
471467
],
472468
[
@@ -528,11 +524,7 @@ const propertyMap: Map<string, Record<string, string> | ((val: string) => string
528524
[
529525
'border-left',
530526
val => {
531-
if (isUnit(val)) {
532-
return `border-l-[${getCustomVal(val)}]`
533-
} else {
534-
return `[border-left:${getCustomVal(val)}]`
535-
}
527+
return `[border-left:${getCustomVal(val)}]`
536528
}
537529
],
538530
[
@@ -577,11 +569,7 @@ const propertyMap: Map<string, Record<string, string> | ((val: string) => string
577569
[
578570
'border-right',
579571
val => {
580-
if (isUnit(val)) {
581-
return `border-r-[${getCustomVal(val)}]`
582-
} else {
583-
return `[border-right:${getCustomVal(val)}]`
584-
}
572+
return `[border-right:${getCustomVal(val)}]`
585573
}
586574
],
587575
[
@@ -609,11 +597,7 @@ const propertyMap: Map<string, Record<string, string> | ((val: string) => string
609597
[
610598
'border-top',
611599
val => {
612-
if (isUnit(val)) {
613-
return `border-t-[${getCustomVal(val)}]`
614-
} else {
615-
return `[border-top:${getCustomVal(val)}]`
616-
}
600+
return `[border-top:${getCustomVal(val)}]`
617601
}
618602
],
619603
[

npm/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "css-to-tailwind-translator",
3-
"version": "1.2.6",
3+
"version": "1.2.8",
44
"description": "Convert CSS code to Tailwindcss syntax in real time",
55
"scripts": {},
66
"repository": {
@@ -42,4 +42,4 @@
4242
"css-to-tailwind-translator",
4343
"convert css code to tailwindcss"
4444
]
45-
}
45+
}

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "css-to-tailwind",
3-
"version": "1.2.6",
3+
"version": "1.2.8",
44
"private": true,
55
"scripts": {
66
"dev": "next dev",
@@ -15,7 +15,7 @@
1515
"@monaco-editor/react": "^4.4.6",
1616
"clipboard": "^2.0.11",
1717
"clsx": "^1.2.1",
18-
"css-to-tailwind-translator": "^1.2.6",
18+
"css-to-tailwind-translator": "^1.2.8",
1919
"next": "13.2.4",
2020
"react": "18.2.0",
2121
"react-dom": "18.2.0",
@@ -41,4 +41,4 @@
4141
"tailwindcss": "^3.2.7",
4242
"typescript": "5.0.2"
4343
}
44-
}
44+
}

pnpm-lock.yaml

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)