Skip to content

Commit a8be479

Browse files
authored
Merge pull request #17 from DeepBlueCLtd/16-animate-addition-of-plus-icons
animate introduction of plus icon
2 parents af9af4f + d504a6f commit a8be479

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

src/style.css

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,17 @@ button:focus-visible {
8282
outline: 4px auto -webkit-focus-ring-color;
8383
}
8484

85+
.gs-plus-icon {
86+
opacity: 0;
87+
transform: scale(0.7);
88+
transition: opacity 500ms cubic-bezier(0.4,0,0.2,1), transform 500ms cubic-bezier(0.4,0,0.2,1);
89+
}
90+
91+
.gs-plus-icon.gs-plus-icon--visible {
92+
opacity: 1;
93+
transform: scale(1);
94+
}
95+
8596
@media (prefers-color-scheme: light) {
8697
:root {
8798
color: #213547;

src/ui/header-utils.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ const PLUS_ICON_CLASS = 'gs-plus-icon';
99
const HEADER_WITH_ICON_CLASS = 'gs-has-plus-icon';
1010
const PLUS_ICON_ACTIVE_CLASS = 'gs-plus-icon--active';
1111

12+
const SHORT_TIME = 10
13+
1214
export function injectPlusIcons(table: HTMLTableElement, columnTypes: ColumnType[]): void {
1315
// Remove any existing plus icons first
1416
removePlusIcons(table);
@@ -105,6 +107,12 @@ function addPlusIconToHeader(header: HTMLTableCellElement, type: HeaderType): vo
105107
plusIcon.textContent = '+';
106108
plusIcon.style.marginLeft = '4px';
107109
plusIcon.style.cursor = 'pointer';
110+
111+
// Animate appearance
112+
// Add the visible class after a tick to trigger the transition
113+
setTimeout(() => {
114+
plusIcon.classList.add('gs-plus-icon--visible');
115+
}, SHORT_TIME);
108116

109117
// Add click handler
110118
plusIcon.addEventListener('click', (e) => {

0 commit comments

Comments
 (0)