8000 Highlight output box upon submit · wimpyprogrammer/strings-to-regex@cd880fe · GitHub
[go: up one dir, main page]

Skip to content

Commit cd880fe

Browse files
Highlight output box upon submit
1 parent bcac42a commit cd880fe

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

demo/styles.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222

2323
#output {
2424
height: 5em;
25+
26+
border-width: 4px;
27+
transition: border-color 0.6s ease-out;
2528
}
2629

2730
@media (min-width: 992px) {

src/demo.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,18 @@ function generatePattern(
2222
return pattern;
2323
}
2424

25+
let clearSuccessIndicatorHandle: number;
2526
function displayPattern(pattern: string) {
2627
$output.value = pattern;
28+
29+
// Temporarily style the output box as valid
30+
$output.classList.add('is-valid');
31+
32+
clearTimeout(clearSuccessIndicatorHandle);
33+
clearSuccessIndicatorHandle = setTimeout(
34+
() => $output.classList.remove('is-valid'),
35+
1000
36+
);
2737
}
2838

2939
function onClickGenerate() {

0 commit comments

Comments
 (0)
0