Skip to content

Commit

Permalink
Implement sponsor component and add sponsor data
Browse files Browse the repository at this point in the history
  • Loading branch information
sukso96100 committed Jan 14, 2024
1 parent 28264cb commit 6067c80
Show file tree
Hide file tree
Showing 8 changed files with 276 additions and 158 deletions.
31 changes: 31 additions & 0 deletions src/components/SponsorLogoAndModal.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { Button, Modal } from "@canonical/react-components";
import { useState } from "react";

type SponsorLogoAndModalProps = {
name: string,
level: string,
logoImageSrc: string,
description: string,
url: string,
}
export default function SponsorLogoAndModal(props: SponsorLogoAndModalProps) {
const [modalOpen, setModalOpen] = useState(false);
const closeHandler = () => setModalOpen(false);
return (
<>
<img src={props.logoImageSrc} alt={props.name} onClick={() => setModalOpen(true)} />
{modalOpen ? <Modal close={closeHandler} title="About the sponsor" buttonRow={<>
<Button appearance="positive" element="a" href={props.url}>
Visit website
</Button>
</>}>
<img src={props.logoImageSrc} alt={props.name} />
<h1>{props.name}</h1>
<b>{props.level}</b>
<p>
{props.description}
</p>
</Modal> : null}
</>
)
}
44 changes: 44 additions & 0 deletions src/components/Sponsors.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
import { sponsors } from "@data/sponsors";
import { Strip, Col, Row } from "@canonical/react-components";
import SponsorLogoAndModal from "@components/SponsorLogoAndModal.tsx";
---

<Strip type="light">
<h2>Our Sponsors</h2>
{
sponsors.map((level) => (
<>
<Row>
<hr class="p-rule" />
</Row>
<Row>
<Col size={3}>
<h3>{level.sponsorLevelName}</h3>
</Col>
<Col size={9}>
<Row>
{level.list.map((item) => (
<Col
style={{ paddingTop: 10 }}
size={level.sizeOnLargeScreen}
medium={level.sizeOnMediumScreen}
small={level.sizeOnSmallScreen}
>
<SponsorLogoAndModal
name={item.name}
logoImageSrc={item.logoUrl}
description={item.description}
url={item.url}
level={level.sponsorLevelName}
client:only="react"
/>
</Col>
))}
</Row>
</Col>
</Row>
</>
))
}
</Strip>
11 changes: 10 additions & 1 deletion src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,16 @@ export const config = {
},
{
label: 'Sponsors/Patrons',
url: '#'
items: [
{
label: 'Become a sponsor',
url: '/sponsors/become-a-sponsor'
},
{
label: 'Our sponsors',
url: '/sponsors/our-sponsors'
}
]
},
{
label: 'News',
Expand Down
161 changes: 161 additions & 0 deletions src/data/sponsors.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
import type { ColSize } from "@canonical/react-components"
import logoPlaceHolder from "@assets/logo_placeholder.svg";

export const sponsors = [
{
sponsorLevelName: "Diamond",
sizeOnLargeScreen: 6 as ColSize,
sizeOnMediumScreen: 6 as ColSize,
sizeOnSmallScreen: 6 as ColSize,
list: [
{
name: "Sponsor name",
logoUrl: logoPlaceHolder.src,
url: "https://www.ubuntu.com/",
description: "Canonical is the publisher of Ubuntu, the OS for most public cloud workloads as well as the emerging categories of smart gateways, self-driving cars, and advanced robots. Canonical provides enterprise security, support, and services to commercial users of Ubuntu."
}
]
},
{
sponsorLevelName: "Platinum",
sizeOnLargeScreen: 4 as ColSize,
sizeOnMediumScreen: 4 as ColSize,
sizeOnSmallScreen: 3 as ColSize,
list: [
{
name: "Sponsor name",
logoUrl: logoPlaceHolder.src,
url: "https://www.ubuntu.com/",
description: "Canonical is the publisher of Ubuntu, the OS for most public cloud workloads as well as the emerging categories of smart gateways, self-driving cars, and advanced robots. Canonical provides enterprise security, support, and services to commercial users of Ubuntu."
},
{
name: "Sponsor name",
logoUrl: logoPlaceHolder.src,
url: "https://www.ubuntu.com/",
description: "Canonical is the publisher of Ubuntu, the OS for most public cloud workloads as well as the emerging categories of smart gateways, self-driving cars, and advanced robots. Canonical provides enterprise security, support, and services to commercial users of Ubuntu."
}
]
},
{
sponsorLevelName: "Gold",
sizeOnLargeScreen: 4 as ColSize,
sizeOnMediumScreen: 4 as ColSize,
sizeOnSmallScreen: 3 as ColSize,
list: [
{
name: "Sponsor name",
logoUrl: logoPlaceHolder.src,
url: "https://www.ubuntu.com/",
description: "Canonical is the publisher of Ubuntu, the OS for most public cloud workloads as well as the emerging categories of smart gateways, self-driving cars, and advanced robots. Canonical provides enterprise security, support, and services to commercial users of Ubuntu."
},
{
name: "Sponsor name",
logoUrl: logoPlaceHolder.src,
url: "https://www.ubuntu.com/",
description: "Canonical is the publisher of Ubuntu, the OS for most public cloud workloads as well as the emerging categories of smart gateways, self-driving cars, and advanced robots. Canonical provides enterprise security, support, and services to commercial users of Ubuntu."
},
{
name: "Sponsor name",
logoUrl: logoPlaceHolder.src,
url: "https://www.ubuntu.com/",
description: "Canonical is the publisher of Ubuntu, the OS for most public cloud workloads as well as the emerging categories of smart gateways, self-driving cars, and advanced robots. Canonical provides enterprise security, support, and services to commercial users of Ubuntu."
}
]
},
{
sponsorLevelName: "Silver",
sizeOnLargeScreen: 3 as ColSize,
sizeOnMediumScreen: 3 as ColSize,
sizeOnSmallScreen: 2 as ColSize,
list: [
{
name: "Sponsor name",
logoUrl: logoPlaceHolder.src,
url: "https://www.ubuntu.com/",
description: "Canonical is the publisher of Ubuntu, the OS for most public cloud workloads as well as the emerging categories of smart gateways, self-driving cars, and advanced robots. Canonical provides enterprise security, support, and services to commercial users of Ubuntu."
},
{
name: "Sponsor name",
logoUrl: logoPlaceHolder.src,
url: "https://www.ubuntu.com/",
description: "Canonical is the publisher of Ubuntu, the OS for most public cloud workloads as well as the emerging categories of smart gateways, self-driving cars, and advanced robots. Canonical provides enterprise security, support, and services to commercial users of Ubuntu."
},
{
name: "Sponsor name",
logoUrl: logoPlaceHolder.src,
url: "https://www.ubuntu.com/",
description: "Canonical is the publisher of Ubuntu, the OS for most public cloud workloads as well as the emerging categories of smart gateways, self-driving cars, and advanced robots. Canonical provides enterprise security, support, and services to commercial users of Ubuntu."
},
{
name: "Sponsor name",
logoUrl: logoPlaceHolder.src,
url: "https://www.ubuntu.com/",
description: "Canonical is the publisher of Ubuntu, the OS for most public cloud workloads as well as the emerging categories of smart gateways, self-driving cars, and advanced robots. Canonical provides enterprise security, support, and services to commercial users of Ubuntu."
}
]
},
{
sponsorLevelName: "Bronze",
sizeOnLargeScreen: 2 as ColSize,
sizeOnMediumScreen: 2 as ColSize,
sizeOnSmallScreen: 1 as ColSize,
list: [
{
name: "Sponsor name",
logoUrl: logoPlaceHolder.src,
url: "https://www.ubuntu.com/",
description: "Canonical is the publisher of Ubuntu, the OS for most public cloud workloads as well as the emerging categories of smart gateways, self-driving cars, and advanced robots. Canonical provides enterprise security, support, and services to commercial users of Ubuntu."
},
{
name: "Sponsor name",
logoUrl: logoPlaceHolder.src,
url: "https://www.ubuntu.com/",
description: "Canonical is the publisher of Ubuntu, the OS for most public cloud workloads as well as the emerging categories of smart gateways, self-driving cars, and advanced robots. Canonical provides enterprise security, support, and services to commercial users of Ubuntu."
},
{
name: "Sponsor name",
logoUrl: logoPlaceHolder.src,
url: "https://www.ubuntu.com/",
description: "Canonical is the publisher of Ubuntu, the OS for most public cloud workloads as well as the emerging categories of smart gateways, self-driving cars, and advanced robots. Canonical provides enterprise security, support, and services to commercial users of Ubuntu."
},
{
name: "Sponsor name",
logoUrl: logoPlaceHolder.src,
url: "https://www.ubuntu.com/",
description: "Canonical is the publisher of Ubuntu, the OS for most public cloud workloads as well as the emerging categories of smart gateways, self-driving cars, and advanced robots. Canonical provides enterprise security, support, and services to commercial users of Ubuntu."
}
]
},
{
sponsorLevelName: "Supporter",
sizeOnLargeScreen: 2 as ColSize,
sizeOnMediumScreen: 2 as ColSize,
sizeOnSmallScreen: 1 as ColSize,
list: [
{
name: "Sponsor name",
logoUrl: logoPlaceHolder.src,
url: "https://www.ubuntu.com/",
description: "Canonical is the publisher of Ubuntu, the OS for most public cloud workloads as well as the emerging categories of smart gateways, self-driving cars, and advanced robots. Canonical provides enterprise security, support, and services to commercial users of Ubuntu."
},
{
name: "Sponsor name",
logoUrl: logoPlaceHolder.src,
url: "https://www.ubuntu.com/",
description: "Canonical is the publisher of Ubuntu, the OS for most public cloud workloads as well as the emerging categories of smart gateways, self-driving cars, and advanced robots. Canonical provides enterprise security, support, and services to commercial users of Ubuntu."
},
{
name: "Sponsor name",
logoUrl: logoPlaceHolder.src,
url: "https://www.ubuntu.com/",
description: "Canonical is the publisher of Ubuntu, the OS for most public cloud workloads as well as the emerging categories of smart gateways, self-driving cars, and advanced robots. Canonical provides enterprise security, support, and services to commercial users of Ubuntu."
},
{
name: "Sponsor name",
logoUrl: logoPlaceHolder.src,
url: "https://www.ubuntu.com/",
description: "Canonical is the publisher of Ubuntu, the OS for most public cloud workloads as well as the emerging categories of smart gateways, self-driving cars, and advanced robots. Canonical provides enterprise security, support, and services to commercial users of Ubuntu."
}
]
}
]
Loading

0 comments on commit 6067c80

Please sign in to comment.