Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SCSE-224] Add navigation to sponsors' homepage on click in the carousel #72

Merged
merged 2 commits into from
Mar 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion apps/web/pages/api/sponsors.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { CarouselProps } from "ui";

export const sponsorsImageData: CarouselProps["items"] = [
{
imageSrc:
Expand Down
34 changes: 30 additions & 4 deletions apps/web/pages/sponsors.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Carousel, FooterContentButton } from "ui";
import { FooterContentButton, Image } from "ui";
import { sponsorsImageData } from "@/pages/api/sponsors";
import { Divider, Heading, VStack } from "@chakra-ui/react";

import { Box, Divider, Heading, Link, SimpleGrid, VStack } from "@chakra-ui/react";
const Sponsors = () => {
return (
<>
Expand All @@ -15,7 +14,34 @@ const Sponsors = () => {
borderBottom="0px"
borderColor="black"
></Divider>
<Carousel items={sponsorsImageData} />

{/* Sponsors Grid */}
<Box>
<SimpleGrid
columns={{ sm: 1, md: 2, lg: 3 }}
spacing={["30px", "50px", "150px"]}
marginBottom="5rem"
marginTop="3rem"
>
{sponsorsImageData.map(({ imageSrc, altText, href }) => (
<Box key={altText} width="250px" height="100px" mx={4}>
<Link href={href}>
<Image
height={100}
width={250}
src={imageSrc}
alt={altText}
style={{
objectFit: "contain",
height: "100px",
width: "250px",
}}
/>
</Link>
</Box>
))}
</SimpleGrid>
</Box>
</VStack>
<FooterContentButton
href="./contact"
Expand Down
33 changes: 16 additions & 17 deletions packages/ui/components/carousel/AnimatedCarousel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
SystemStyleObject,
} from "@chakra-ui/react";
import { Image } from "../image";
import Link from "next/link";

export interface AnimatedCarouselProps extends FlexProps {
items: Array<{
Expand All @@ -18,29 +19,30 @@ export interface AnimatedCarouselProps extends FlexProps {
const CarouselSlides = ({ items }: AnimatedCarouselProps) => {
return (
<>
{items.map(({ imageSrc, altText }) => (
{items.map(({ imageSrc, altText, href }) => (
<Box key={altText} width="250px" height="100px" mx={4}>
{" "}
{/* slide */}
<Image
height={100}
width={250}
src={imageSrc}
alt={altText}
style={{
objectFit: "contain",
height: "100px",
width: "250px",
}}
/>
<Link href={href}>
<Image
height={100}
width={250}
src={imageSrc}
alt={altText}
style={{
objectFit: "contain",
height: "100px",
width: "250px",
}}
/>
</Link>
</Box>
))}
</>
);
};

const sideGradient: SystemStyleObject = {
// background: `linear-gradient(to right, rgba(255,255,255,1) 0%,rgba(255,255,255,0) 100%)`,
bgGradient: "linear(to-r, rgba(255,255,255,1) 0%,rgba(255,255,255,0) 100%)",
content: `""`,
height: "100px",
Expand All @@ -49,10 +51,7 @@ const sideGradient: SystemStyleObject = {
zIndex: 2,
};

export const AnimatedCarousel = ({
items,
...props
}: AnimatedCarouselProps) => {
export const AnimatedCarousel = ({ items, ...props }: AnimatedCarouselProps) => {
const scroll = keyframes`
0% {
transform: translateX(0)
Expand Down
1 change: 0 additions & 1 deletion packages/ui/components/carousel/Carousel.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ const Template: ComponentStory<typeof Carousel> = (args) => (
export const Primary = Template.bind({});

Primary.args = {
headingText: "OUR SPONSORS",
items: [
{
imageSrc:
Expand Down
44 changes: 0 additions & 44 deletions packages/ui/components/carousel/SponsorImages/SponsorImages.txt

This file was deleted.

2 changes: 1 addition & 1 deletion packages/ui/components/carousel/index.tsx
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export { Carousel } from "./Carousel";
export type { CarouselProps } from "./Carousel";
export type { CarouselProps } from "./Carousel";