diff options
author | (quasar) nebula <towerofnix@gmail.com> | 2021-05-15 19:08:48 -0300 |
---|---|---|
committer | (quasar) nebula <towerofnix@gmail.com> | 2021-05-25 19:07:09 -0300 |
commit | d41853b617e1b0e7fa41309ff0d42611305c3149 (patch) | |
tree | 13d4c0312f95efb22bb103fd3df07f6f0bbb2a79 /src/util/link.js | |
parent | 4fd0d8b5485f94ad67d32bc6a9273ac4727a6475 (diff) |
bigass code refactor (no more legacy page writes)
Diffstat (limited to 'src/util/link.js')
-rw-r--r-- | src/util/link.js | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/util/link.js b/src/util/link.js index e5c3c596..107b35ff 100644 --- a/src/util/link.js +++ b/src/util/link.js @@ -14,15 +14,21 @@ import { getLinkThemeString } from './colors.js' const linkHelper = (hrefFn, {color = true, attr = null} = {}) => (thing, { - strings, to, + to, text = '', + attributes = null, class: className = '', + color: color2 = true, hash = '' }) => ( html.tag('a', { ...attr ? attr(thing) : {}, + ...attributes ? attributes : {}, href: hrefFn(thing, {to}) + (hash ? (hash.startsWith('#') ? '' : '#') + hash : ''), - style: color ? getLinkThemeString(thing.color) : '', + style: ( + typeof color2 === 'string' ? getLinkThemeString(color2) : + color2 && color ? getLinkThemeString(thing.color) : + ''), class: className }, text || thing.name) ); |