💄 Optimized UX
This commit is contained in:
parent
6624e4e0ab
commit
bc2de51987
8
.idea/.gitignore
vendored
Normal file
8
.idea/.gitignore
vendored
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
|
# Editor-based HTTP Client requests
|
||||||
|
/httpRequests/
|
||||||
|
# Datasource local storage ignored files
|
||||||
|
/dataSources/
|
||||||
|
/dataSources.local.xml
|
12
.idea/Capital.iml
Normal file
12
.idea/Capital.iml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="WEB_MODULE" version="4">
|
||||||
|
<component name="NewModuleRootManager">
|
||||||
|
<content url="file://$MODULE_DIR$">
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/temp" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/tmp" />
|
||||||
|
</content>
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
|
</module>
|
8
.idea/modules.xml
Normal file
8
.idea/modules.xml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectModuleManager">
|
||||||
|
<modules>
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/.idea/Capital.iml" filepath="$PROJECT_DIR$/.idea/Capital.iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
6
.idea/vcs.xml
Normal file
6
.idea/vcs.xml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -8,11 +8,11 @@ import { POST_TYPES } from "../scripts/consts";
|
|||||||
const { posts } = Astro.props;
|
const { posts } = Astro.props;
|
||||||
---
|
---
|
||||||
|
|
||||||
<div class="grid justify-items-strench gap-6">
|
<div class="grid justify-items-strench shadow-lg">
|
||||||
{
|
{
|
||||||
posts?.map((item) => (
|
posts?.map((item) => (
|
||||||
<a href={`/p/${item.slug}`}>
|
<a href={`/p/${item.slug}`}>
|
||||||
<div class="card sm:card-side hover:bg-base-200 transition-colors sm:max-w-none shadow-xl">
|
<div class="card sm:card-side hover:bg-base-200 transition-colors sm:max-w-none">
|
||||||
{item.cover.image.url && (
|
{item.cover.image.url && (
|
||||||
<figure class="mx-auto w-full object-cover p-6 max-sm:pb-0 sm:max-w-[12rem] sm:pe-0">
|
<figure class="mx-auto w-full object-cover p-6 max-sm:pb-0 sm:max-w-[12rem] sm:pe-0">
|
||||||
<img
|
<img
|
||||||
|
@ -182,38 +182,6 @@ const { events } = (
|
|||||||
</div>
|
</div>
|
||||||
</RootLayout>
|
</RootLayout>
|
||||||
|
|
||||||
<script>
|
|
||||||
function debounce(func: any, timeout = 300) {
|
|
||||||
let timer: number;
|
|
||||||
return (...args: any[]) => {
|
|
||||||
clearTimeout(timer);
|
|
||||||
// @ts-ignore
|
|
||||||
timer = setTimeout(() => {
|
|
||||||
// @ts-ignore
|
|
||||||
func.apply(this, args);
|
|
||||||
}, timeout);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// Makes scroll means slide to next page
|
|
||||||
const wrapper = document.querySelector<HTMLDivElement>(".wrapper");
|
|
||||||
const template = document.querySelector<HTMLDivElement>("#hello");
|
|
||||||
const scroll = debounce((negative: boolean) => {
|
|
||||||
if (wrapper) {
|
|
||||||
console.log("scrolled");
|
|
||||||
let range = negative
|
|
||||||
? -(template?.clientHeight ?? 0)
|
|
||||||
: template?.clientHeight ?? 0;
|
|
||||||
wrapper.scrollTop += range;
|
|
||||||
}
|
|
||||||
}, 40); // 40ms to prevent touchpad and smooth scroll software
|
|
||||||
wrapper?.addEventListener("wheel", (event) => {
|
|
||||||
event.preventDefault();
|
|
||||||
event.stopPropagation();
|
|
||||||
scroll(event.deltaY < 0);
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.spinning {
|
.spinning {
|
||||||
animation: 5s ease-in-out infinite running spinning;
|
animation: 5s ease-in-out infinite running spinning;
|
||||||
|
@ -8,8 +8,8 @@ export const prerender = false;
|
|||||||
|
|
||||||
const {posts} = (
|
const {posts} = (
|
||||||
await graphQuery(
|
await graphQuery(
|
||||||
`query Query($where: PostWhereInput!) {
|
`query Query($where: PostWhereInput!, $orderBy: [PostOrderByInput!]!) {
|
||||||
posts(where: $where) {
|
posts(where: $where, orderBy: $orderBy) {
|
||||||
slug
|
slug
|
||||||
type
|
type
|
||||||
title
|
title
|
||||||
@ -31,7 +31,14 @@ const { posts } = (
|
|||||||
createdAt
|
createdAt
|
||||||
}
|
}
|
||||||
}`,
|
}`,
|
||||||
{ where: {} }
|
{
|
||||||
|
orderBy: [
|
||||||
|
{
|
||||||
|
createdAt: "desc",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
where: {}
|
||||||
|
}
|
||||||
)
|
)
|
||||||
).data;
|
).data;
|
||||||
---
|
---
|
||||||
|
@ -1,12 +1,17 @@
|
|||||||
|
const defaultCms = "https://smartsheep.studio";
|
||||||
|
|
||||||
export async function graphQuery(query: string, variables: any) {
|
export async function graphQuery(query: string, variables: any) {
|
||||||
const response = await fetch(`${process.env.PUBLIC_CMS}/api/graphql`, {
|
const response = await fetch(
|
||||||
|
`${process.env.PUBLIC_CMS ?? defaultCms}/api/graphql`,
|
||||||
|
{
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: { "Content-Type": "application/json" },
|
headers: { "Content-Type": "application/json" },
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
query,
|
query,
|
||||||
variables,
|
variables,
|
||||||
}),
|
}),
|
||||||
});
|
},
|
||||||
|
);
|
||||||
|
|
||||||
return await response.json();
|
return await response.json();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user