mirror of
https://github.com/LucasVbr/notion-widgets.git
synced 2026-07-09 06:57:58 +00:00
feat: Add global utils functions
This commit is contained in:
@@ -1,4 +1,6 @@
|
|||||||
---
|
---
|
||||||
|
import UrlUtils from '../libs/UrlUtils.astro';
|
||||||
|
import DocumentSelector from '../libs/DocumentSelector.astro';
|
||||||
export interface Props {
|
export interface Props {
|
||||||
title: string;
|
title: string;
|
||||||
}
|
}
|
||||||
@@ -19,4 +21,8 @@ const {title} = Astro.props;
|
|||||||
<body>
|
<body>
|
||||||
<slot/>
|
<slot/>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
<UrlUtils/>
|
||||||
|
<DocumentSelector/>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
---
|
||||||
|
|
||||||
|
<script is:inline>
|
||||||
|
const $ = (selector) => document.querySelector(selector)
|
||||||
|
</script>
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
---
|
||||||
|
---
|
||||||
|
|
||||||
|
<script is:inline>
|
||||||
|
const getUrlParams = (defaultParams = {}) => {
|
||||||
|
let params = {...defaultParams};
|
||||||
|
|
||||||
|
const urlParams = new URLSearchParams(window.location.search);
|
||||||
|
urlParams.forEach((value, key) => {
|
||||||
|
if (key && value) params[key] = value
|
||||||
|
})
|
||||||
|
return params
|
||||||
|
}
|
||||||
|
</script>
|
||||||
Reference in New Issue
Block a user