Skip to content

Commit 3c68487

Browse files
franxxuDun-sin
andauthored
fix: open results button showing wrongly #441 (#451)
Co-authored-by: Dunsin <[email protected]>
1 parent b3c14b2 commit 3c68487

File tree

5 files changed

+29
-17
lines changed

5 files changed

+29
-17
lines changed

src/pages/box-shadow.ts

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@ import {
1515
getTailwindButton,
1616
getCssOrTailwindButton,
1717
getCssOrTailwindDropdown,
18+
getOpenSideBarButton,
19+
getAllInputElements,
1820
} from '../lib/getElements';
1921
import {
20-
triggerEmptyAnimation,
2122
copyCSSCodeToClipboard,
2223
copyTailwindCodeToClipboard,
2324
showPopup,
@@ -37,6 +38,8 @@ const attribute = 'box-shadow';
3738
let isSliderOpen = false;
3839
const getCssOrTailwindDropdownElement = getCssOrTailwindDropdown(attribute);
3940
const showCopyClass = 'show-css-tailwind';
41+
const boxshadowInputs = getAllInputElements(attribute);
42+
4043
function copyHandler() {
4144
const outputElement = getOutput(attribute);
4245
copyCSSCodeToClipboard(attribute, outputElement);
@@ -67,23 +70,17 @@ export function boxShadowGenerator(
6770
const color = getShadowColor(attribute);
6871
const getOutputElement = getOutput(attribute);
6972
const resultPage = getResultPage();
70-
71-
if (
72-
horizontalOffset.value === '' ||
73-
verticalOffset.value === '' ||
74-
blur.value === '' ||
75-
spread.value === '' ||
76-
color.value === ''
77-
) {
78-
triggerEmptyAnimation(color);
79-
const resultBtn = getResultButton(attribute);
80-
if(resultBtn){
81-
resultBtn.style.backgroundColor = 'grey';
82-
}
83-
return;
73+
74+
const element = boxshadowInputs[0];
75+
const value = element.value;
76+
77+
if (value.length < 3) {
78+
getOpenSideBarButton().style.display = 'none';
79+
}else{
80+
getOpenSideBarButton().style.display = 'flex';
81+
resultPage.style.display = 'flex';
8482
}
8583

86-
resultPage.style.display = 'flex';
8784
if (type === 'oldResults') return;
8885

8986
const values: Values = {

src/pages/gradient-background.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
getCssOrTailwindDropdown,
1313
getTailwindButton,
1414
getCssOrTailwindButton,
15+
getOpenSideBarButton,
1516
} from '../lib/getElements';
1617
import {
1718
triggerEmptyAnimation,
@@ -55,6 +56,7 @@ export function gradientBackgroundGenerator(
5556
if (getResultBtn) {
5657
getResultBtn.style.backgroundColor = 'grey';
5758
}
59+
getOpenSideBarButton().style.display = 'none';
5860
triggerEmptyAnimation(ele);
5961
});
6062
return;

src/pages/gradient-border.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
getTailwindButton,
1515
getCssOrTailwindButton,
1616
getCssOrTailwindDropdown,
17+
getOpenSideBarButton,
1718
} from '../lib/getElements';
1819
import {
1920
copyCSSCodeToClipboard,
@@ -105,7 +106,15 @@ export function gradientBorderGenerator(
105106
type: 'newResults' | 'oldResults' | null
106107
): void {
107108
if (type === null) return;
108-
resultPage.style.display = 'flex';
109+
const element = gradientBorderInputs[0];
110+
const value = element.value;
111+
if (value.length < 3) {
112+
getOpenSideBarButton().style.display = 'none';
113+
}else{
114+
getOpenSideBarButton().style.display = 'flex';
115+
resultPage.style.display = 'flex';
116+
}
117+
109118

110119
if (type === 'oldResults') return;
111120

src/pages/gradient-text.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import {
1717
getCssOrTailwindDropdown,
1818
getPngOrSvgButton,
1919
getPngOrSvgDropdown,
20+
getOpenSideBarButton,
2021
} from '../lib/getElements';
2122
import {
2223
copyCSSCodeToClipboard,
@@ -96,6 +97,7 @@ export function gradientTextGenerator(
9697
const getInputElement = getInputText(attribute);
9798

9899
if (getInputElement.value.length === 0) {
100+
getOpenSideBarButton().style.display = 'none';
99101
triggerEmptyAnimation(getInputElement);
100102
return;
101103
}

src/pages/text-shadow.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import {
1818
getCssOrTailwindDropdown,
1919
getPngOrSvgButton,
2020
getPngOrSvgDropdown,
21+
getOpenSideBarButton,
2122
} from '../lib/getElements';
2223
import {
2324
copyCSSCodeToClipboard,
@@ -96,6 +97,7 @@ export function textShadowGenerator(
9697
const resultPage = getResultPage();
9798

9899
if (getInputElement.value.length === 0) {
100+
getOpenSideBarButton().style.display = 'none';
99101
triggerEmptyAnimation(getInputElement);
100102
return;
101103
}

0 commit comments

Comments
 (0)