mirror of
https://github.com/LucasVbr/notion-widgets.git
synced 2026-05-13 17:21:55 +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 {
|
||||
title: string;
|
||||
}
|
||||
@@ -19,4 +21,8 @@ const {title} = Astro.props;
|
||||
<body>
|
||||
<slot/>
|
||||
</body>
|
||||
|
||||
<UrlUtils/>
|
||||
<DocumentSelector/>
|
||||
|
||||
</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