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
@@ -15,6 +15,13 @@
|
|||||||
"izenburua": {
|
"izenburua": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
"hilekoEgitaraua": {
|
||||||
|
"type": "media",
|
||||||
|
"multiple": false,
|
||||||
|
"allowedTypes": [
|
||||||
|
"files"
|
||||||
|
]
|
||||||
|
},
|
||||||
"banner": {
|
"banner": {
|
||||||
"type": "component",
|
"type": "component",
|
||||||
"component": "hasiera.banner",
|
"component": "hasiera.banner",
|
||||||
|
|||||||
+1
@@ -537,6 +537,7 @@ export interface ApiHasieraHasiera extends Struct.SingleTypeSchema {
|
|||||||
createdAt: Schema.Attribute.DateTime;
|
createdAt: Schema.Attribute.DateTime;
|
||||||
createdBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> &
|
createdBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> &
|
||||||
Schema.Attribute.Private;
|
Schema.Attribute.Private;
|
||||||
|
hilekoEgitaraua: Schema.Attribute.Media<'files'>;
|
||||||
izanLabazkide: Schema.Attribute.Component<'hasiera.izan-labazkide', false> &
|
izanLabazkide: Schema.Attribute.Component<'hasiera.izan-labazkide', false> &
|
||||||
Schema.Attribute.Required;
|
Schema.Attribute.Required;
|
||||||
izenburua: Schema.Attribute.String;
|
izenburua: Schema.Attribute.String;
|
||||||
|
|||||||
@@ -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 { ImageMedia } from "./ImageMedia";
|
||||||
import type { Markdown } from "./Markdown";
|
import type { Markdown } from "./Markdown";
|
||||||
|
|
||||||
@@ -26,6 +27,7 @@ export interface Banner {
|
|||||||
export interface Hasiera {
|
export interface Hasiera {
|
||||||
id: number;
|
id: number;
|
||||||
izenburua: string;
|
izenburua: string;
|
||||||
|
hilekoEgitaraua: FileMedia;
|
||||||
banner: Banner[];
|
banner: Banner[];
|
||||||
izanLabazkide: {
|
izanLabazkide: {
|
||||||
izenburua: string;
|
izenburua: string;
|
||||||
|
|||||||
@@ -11,6 +11,10 @@ const response = await fetch(`${import.meta.env.STRAPI_URL}/graphql`, {
|
|||||||
query {
|
query {
|
||||||
hasiera {
|
hasiera {
|
||||||
izenburua
|
izenburua
|
||||||
|
hilekoEgitaraua {
|
||||||
|
mime
|
||||||
|
url
|
||||||
|
}
|
||||||
banner {
|
banner {
|
||||||
izenburua
|
izenburua
|
||||||
url
|
url
|
||||||
|
|||||||
@@ -7,15 +7,23 @@ export interface Props {
|
|||||||
title?: string;
|
title?: string;
|
||||||
description?: string;
|
description?: string;
|
||||||
isMainTitle?: boolean;
|
isMainTitle?: boolean;
|
||||||
|
hilekoEgitarauaUrl?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { ekintzak, title, description, isMainTitle = false } = Astro.props;
|
const {
|
||||||
|
ekintzak,
|
||||||
|
title,
|
||||||
|
description,
|
||||||
|
isMainTitle = false,
|
||||||
|
hilekoEgitarauaUrl,
|
||||||
|
} = Astro.props;
|
||||||
---
|
---
|
||||||
|
|
||||||
<EkintzaZerrendaReact
|
<EkintzaZerrendaReact
|
||||||
ekintzak={ekintzak}
|
ekintzak={ekintzak}
|
||||||
title={title}
|
title={title}
|
||||||
description={description}
|
description={description}
|
||||||
isMainTitle
|
isMainTitle={isMainTitle}
|
||||||
|
hilekoEgitarauaUrl={hilekoEgitarauaUrl}
|
||||||
client:idle
|
client:idle
|
||||||
/>
|
/>
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
@use "../../../../style/mixins/displayFonts.scss";
|
@use "../../../../style/mixins/displayFonts.scss";
|
||||||
@use "../../../../style/tools/mediaQueries.scss";
|
@use "../../../../style/tools/mediaQueries.scss";
|
||||||
|
@use "../../../../style/tools/toDVW.scss";
|
||||||
@use "sass:color";
|
@use "sass:color";
|
||||||
|
|
||||||
.wrapper {
|
.wrapper {
|
||||||
@@ -92,3 +93,35 @@
|
|||||||
|
|
||||||
@include displayFonts.display2;
|
@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;
|
title?: string;
|
||||||
description?: string;
|
description?: string;
|
||||||
isMainTitle?: boolean;
|
isMainTitle?: boolean;
|
||||||
|
hilekoEgitarauaUrl?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const EkintzaZerrenda: React.FC<Props> = ({
|
export const EkintzaZerrenda: React.FC<Props> = ({
|
||||||
@@ -18,17 +19,18 @@ export const EkintzaZerrenda: React.FC<Props> = ({
|
|||||||
description,
|
description,
|
||||||
ekintzak,
|
ekintzak,
|
||||||
isMainTitle = false,
|
isMainTitle = false,
|
||||||
|
hilekoEgitarauaUrl,
|
||||||
}) => {
|
}) => {
|
||||||
const sortedEkintzak = useMemo(
|
const sortedEkintzak = useMemo(
|
||||||
() =>
|
() =>
|
||||||
[...ekintzak].sort((a, b) =>
|
[...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>(
|
const [activeEkintza, setActiveEkintza] = useState<EkintzaSnippet>(
|
||||||
sortedEkintzak[0]
|
sortedEkintzak[0],
|
||||||
);
|
);
|
||||||
const [playInterval, setPlayInterval] = useState(true);
|
const [playInterval, setPlayInterval] = useState(true);
|
||||||
|
|
||||||
@@ -45,7 +47,7 @@ export const EkintzaZerrenda: React.FC<Props> = ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
setActiveEkintza(
|
setActiveEkintza(
|
||||||
sortedEkintzak[Math.floor(Math.random() * sortedEkintzak.length)]
|
sortedEkintzak[Math.floor(Math.random() * sortedEkintzak.length)],
|
||||||
);
|
);
|
||||||
}, 1800);
|
}, 1800);
|
||||||
|
|
||||||
@@ -59,7 +61,7 @@ export const EkintzaZerrenda: React.FC<Props> = ({
|
|||||||
gsap.fromTo(
|
gsap.fromTo(
|
||||||
imgRef.current,
|
imgRef.current,
|
||||||
{ autoAlpha: 0, scale: 1.05 },
|
{ 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]);
|
}, [activeEkintza]);
|
||||||
@@ -109,6 +111,16 @@ export const EkintzaZerrenda: React.FC<Props> = ({
|
|||||||
</li>
|
</li>
|
||||||
))}
|
))}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
{hilekoEgitarauaUrl && (
|
||||||
|
<a
|
||||||
|
className={styles.hilekoEgitaraua}
|
||||||
|
href={hilekoEgitarauaUrl}
|
||||||
|
download
|
||||||
|
>
|
||||||
|
Ikusi hileko egitaraua PDF-n
|
||||||
|
</a>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import Footer from "../_components/Footer.astro";
|
|||||||
import EkintzaZerrenda from "../_components/EkintzaZerrenda.astro";
|
import EkintzaZerrenda from "../_components/EkintzaZerrenda.astro";
|
||||||
import IrudiEstela from "views/_components/IrudiEstela.astro";
|
import IrudiEstela from "views/_components/IrudiEstela.astro";
|
||||||
import Banner from "./components/Banner.astro";
|
import Banner from "./components/Banner.astro";
|
||||||
|
import { getPDFUrl } from "models/FileMedia";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
hasiera: Hasiera;
|
hasiera: Hasiera;
|
||||||
@@ -26,6 +27,8 @@ const { izenburua, izanLabazkide, parteHartu, mosaikoa, banner }: Hasiera = hasi
|
|||||||
const hurrengoEkintzak = ekintzak.filter((ekintza) =>
|
const hurrengoEkintzak = ekintzak.filter((ekintza) =>
|
||||||
dayjs().isBefore(ekintza.hitzordua)
|
dayjs().isBefore(ekintza.hitzordua)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const hilekoEgitarauaUrl = hasiera.hilekoEgitaraua ? getPDFUrl(hasiera.hilekoEgitaraua) : undefined
|
||||||
---
|
---
|
||||||
|
|
||||||
<Layout
|
<Layout
|
||||||
@@ -54,7 +57,7 @@ const hurrengoEkintzak = ekintzak.filter((ekintza) =>
|
|||||||
<ZigZag from="marroia" />
|
<ZigZag from="marroia" />
|
||||||
|
|
||||||
<section class="agenda" id="agenda">
|
<section class="agenda" id="agenda">
|
||||||
<EkintzaZerrenda ekintzak={hurrengoEkintzak} title="Agenda" />
|
<EkintzaZerrenda ekintzak={hurrengoEkintzak} title="Agenda" hilekoEgitarauaUrl={hilekoEgitarauaUrl} />
|
||||||
</section>
|
</section>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user