Skip to content

Commit

Permalink
Update styling
Browse files Browse the repository at this point in the history
  • Loading branch information
xpdota committed Jun 14, 2024
1 parent 5428e27 commit 65ea4a1
Show file tree
Hide file tree
Showing 9 changed files with 3,219 additions and 6,166 deletions.
38 changes: 38 additions & 0 deletions packages/common-ui/src/components/top_menu.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import {githubIcon, importIcon, makeCalcIcon, makeDollarIcon, mySheetsIcon, newSheetIcon, settingsIcon} from "./util";

export function applyCommonTopMenuFormatting(link: HTMLAnchorElement) {
if (link.getAttribute('formatted') === 'true') {
return;
}
switch (link.textContent) {
case 'My Sheets':
link.replaceChildren(mySheetsIcon(), textSpan(link.textContent));
break;
case 'New Sheet':
link.replaceChildren(newSheetIcon(), textSpan(link.textContent));
break;
case 'Import':
link.replaceChildren(importIcon(), textSpan(link.textContent));
break;
case 'GitHub':
link.replaceChildren(githubIcon());
break;
case 'Settings':
link.replaceChildren(settingsIcon());
break;
case 'Math':
link.replaceChildren(makeCalcIcon());
break;
case 'Ko-Fi':
link.replaceChildren(makeDollarIcon());
break;
}
link.setAttribute('formatted', 'true');
}

function textSpan(text: string) {
const span = document.createElement('span');
span.textContent = text;
return span;
}

56 changes: 56 additions & 0 deletions packages/common-ui/src/components/util.ts

Large diffs are not rendered by default.

Loading

0 comments on commit 65ea4a1

Please sign in to comment.