feat: hileko egitaraua erakusten du
This commit is contained in:
1 parent
ec0c8876dc
commit
8f524f6f79
9 files changed
+90
-8
No files matched your search
@@ -0,0 +1,12 @@
|
||||
export interface FileMedia {
|
||||
mime: "application/pdf";
|
||||
url: string;
|
||||
}
|
||||
|
||||
export function getPDFUrl(fileMedia: FileMedia) {
|
||||
if (fileMedia.mime !== "application/pdf") {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return fileMedia.url;
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
import type { FileMedia } from "./FileMedia";
|
||||
import type { ImageMedia } from "./ImageMedia";
|
||||
import type { Markdown } from "./Markdown";
|
||||
|
||||
@@ -26,6 +27,7 @@ export interface Banner {
|
||||
export interface Hasiera {
|
||||
id: number;
|
||||
izenburua: string;
|
||||
hilekoEgitaraua: FileMedia;
|
||||
banner: Banner[];
|
||||
izanLabazkide: {
|
||||
izenburua: string;
|
||||
|
||||
@@ -11,6 +11,10 @@ const response = await fetch(`${import.meta.env.STRAPI_URL}/graphql`, {
|
||||
query {
|
||||
hasiera {
|
||||
izenburua
|
||||
hilekoEgitaraua {
|
||||
mime
|
||||
url
|
||||
}
|
||||
banner {
|
||||
izenburua
|
||||
url
|
||||
|
||||
@@ -7,15 +7,23 @@ export interface Props {
|
||||
title?: string;
|
||||
description?: string;
|
||||
isMainTitle?: boolean;
|
||||
hilekoEgitarauaUrl?: string;
|
||||
}
|
||||
|
||||
const { ekintzak, title, description, isMainTitle = false } = Astro.props;
|
||||
const {
|
||||
ekintzak,
|
||||
title,
|
||||
description,
|
||||
isMainTitle = false,
|
||||
hilekoEgitarauaUrl,
|
||||
} = Astro.props;
|
||||
---
|
||||
|
||||
<EkintzaZerrendaReact
|
||||
ekintzak={ekintzak}
|
||||
title={title}
|
||||
description={description}
|
||||
isMainTitle
|
||||
isMainTitle={isMainTitle}
|
||||
hilekoEgitarauaUrl={hilekoEgitarauaUrl}
|
||||
client:idle
|
||||
/>
|
||||
@@ -1,5 +1,6 @@
|
||||
@use "../../../../style/mixins/displayFonts.scss";
|
||||
@use "../../../../style/tools/mediaQueries.scss";
|
||||
@use "../../../../style/tools/toDVW.scss";
|
||||
@use "sass:color";
|
||||
|
||||
.wrapper {
|
||||
@@ -92,3 +93,35 @@
|
||||
|
||||
@include displayFonts.display2;
|
||||
}
|
||||
|
||||
.hilekoEgitaraua {
|
||||
display: inline-block;
|
||||
padding: var(--space-03-mobile) var(--space-04-mobile);
|
||||
margin-top: var(--space-07-mobile);
|
||||
grid-column: col-start 3 / span 8;
|
||||
|
||||
color: var(--zuria);
|
||||
background-color: var(--gorria);
|
||||
text-decoration: none;
|
||||
text-align: center;
|
||||
border-radius: var(--space-05-mobile);
|
||||
border: #{toDVW.toMobileDVW(1)} solid var(--gorria);
|
||||
|
||||
transition:
|
||||
background-color 0.3s ease,
|
||||
color 0.3s ease;
|
||||
|
||||
&:hover {
|
||||
color: var(--gorria);
|
||||
background-color: var(--zuria);
|
||||
}
|
||||
|
||||
@include mediaQueries.aboveTablet {
|
||||
padding: var(--space-04-desktop) var(--space-05-desktop);
|
||||
margin-top: var(--space-08-desktop);
|
||||
grid-column: col-start 6 / span 2;
|
||||
|
||||
border-radius: var(--space-06-desktop);
|
||||
border: #{toDVW.toDesktopDVW(1)} solid var(--gorria);
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,7 @@ interface Props {
|
||||
title?: string;
|
||||
description?: string;
|
||||
isMainTitle?: boolean;
|
||||
hilekoEgitarauaUrl?: string;
|
||||
}
|
||||
|
||||
export const EkintzaZerrenda: React.FC<Props> = ({
|
||||
@@ -18,17 +19,18 @@ export const EkintzaZerrenda: React.FC<Props> = ({
|
||||
description,
|
||||
ekintzak,
|
||||
isMainTitle = false,
|
||||
hilekoEgitarauaUrl,
|
||||
}) => {
|
||||
const sortedEkintzak = useMemo(
|
||||
() =>
|
||||
[...ekintzak].sort((a, b) =>
|
||||
dayjs(a.hitzordua).isBefore(b.hitzordua) ? -1 : 1
|
||||
dayjs(a.hitzordua).isBefore(b.hitzordua) ? -1 : 1,
|
||||
),
|
||||
[ekintzak]
|
||||
[ekintzak],
|
||||
);
|
||||
|
||||
const [activeEkintza, setActiveEkintza] = useState<EkintzaSnippet>(
|
||||
sortedEkintzak[0]
|
||||
sortedEkintzak[0],
|
||||
);
|
||||
const [playInterval, setPlayInterval] = useState(true);
|
||||
|
||||
@@ -45,7 +47,7 @@ export const EkintzaZerrenda: React.FC<Props> = ({
|
||||
}
|
||||
|
||||
setActiveEkintza(
|
||||
sortedEkintzak[Math.floor(Math.random() * sortedEkintzak.length)]
|
||||
sortedEkintzak[Math.floor(Math.random() * sortedEkintzak.length)],
|
||||
);
|
||||
}, 1800);
|
||||
|
||||
@@ -59,7 +61,7 @@ export const EkintzaZerrenda: React.FC<Props> = ({
|
||||
gsap.fromTo(
|
||||
imgRef.current,
|
||||
{ autoAlpha: 0, scale: 1.05 },
|
||||
{ autoAlpha: 1, scale: 1, duration: 0.5, ease: "power2.out" }
|
||||
{ autoAlpha: 1, scale: 1, duration: 0.5, ease: "power2.out" },
|
||||
);
|
||||
}
|
||||
}, [activeEkintza]);
|
||||
@@ -109,6 +111,16 @@ export const EkintzaZerrenda: React.FC<Props> = ({
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
|
||||
{hilekoEgitarauaUrl && (
|
||||
<a
|
||||
className={styles.hilekoEgitaraua}
|
||||
href={hilekoEgitarauaUrl}
|
||||
download
|
||||
>
|
||||
Ikusi hileko egitaraua PDF-n
|
||||
</a>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -13,6 +13,7 @@ import Footer from "../_components/Footer.astro";
|
||||
import EkintzaZerrenda from "../_components/EkintzaZerrenda.astro";
|
||||
import IrudiEstela from "views/_components/IrudiEstela.astro";
|
||||
import Banner from "./components/Banner.astro";
|
||||
import { getPDFUrl } from "models/FileMedia";
|
||||
|
||||
interface Props {
|
||||
hasiera: Hasiera;
|
||||
@@ -26,6 +27,8 @@ const { izenburua, izanLabazkide, parteHartu, mosaikoa, banner }: Hasiera = hasi
|
||||
const hurrengoEkintzak = ekintzak.filter((ekintza) =>
|
||||
dayjs().isBefore(ekintza.hitzordua)
|
||||
);
|
||||
|
||||
const hilekoEgitarauaUrl = hasiera.hilekoEgitaraua ? getPDFUrl(hasiera.hilekoEgitaraua) : undefined
|
||||
---
|
||||
|
||||
<Layout
|
||||
@@ -54,7 +57,7 @@ const hurrengoEkintzak = ekintzak.filter((ekintza) =>
|
||||
<ZigZag from="marroia" />
|
||||
|
||||
<section class="agenda" id="agenda">
|
||||
<EkintzaZerrenda ekintzak={hurrengoEkintzak} title="Agenda" />
|
||||
<EkintzaZerrenda ekintzak={hurrengoEkintzak} title="Agenda" hilekoEgitarauaUrl={hilekoEgitarauaUrl} />
|
||||
</section>
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user