Skip to content

Commit

Permalink
Merge branch 'release/0.18.6'
Browse files Browse the repository at this point in the history
  • Loading branch information
troychaplin committed Oct 31, 2024
2 parents cb20ba1 + dcc9f4d commit 3d61826
Show file tree
Hide file tree
Showing 19 changed files with 1,143 additions and 1,984 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,18 @@ Prefix the change with one of these keywords:

## [Unreleased]

## [0.18.6]

### Changed

- Nav component icon style for desktop and mobile with and without title

### Fixed

- Footer style issue to text align center in
- Z-index issue in ImageCover
- Overflow issue in WideWave

## [0.18.5]

### Changed
Expand Down
2 changes: 1 addition & 1 deletion lib/components/Footer/FooterLogoLinks/FooterLogoLinks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const FooterLogoLinks = () => {
src="https://cdn.carleton.ca/rds/assets/cu-logos/cu-logo-color-vertical-outlined.svg"
alt="Logo of Carleton University"
/>
<ul className="flex justify-center space-x-4 text-xs bg-cu-black-900 text-cu-black-300 sm:space-x-6 sm:text-sm">
<ul className="flex flex-wrap justify-center space-x-4 gap-y-4 text-xs bg-cu-black-900 text-cu-black-300 sm:space-x-6 sm:text-sm">
<li key="privacy">
<LinkComponent
href="https://carleton.ca/privacy/privacy-notices/general-notice-of-collection-use-and-disclosure/"
Expand Down
6 changes: 3 additions & 3 deletions lib/components/Footer/FooterStandard/FooterStandard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export const FooterStandard = () => {
</h2>

<div className="flex-col pb-8 md:mx-auto md:mb-8 md:border-b md:block md:max-w-7xl md:border-cu-black-700">
<p className="text-sm md:text-base lg:text-lg text-center font-semibold text-white">
<p className="text-sm md:text-base text-center font-medium text-white">
Carleton University acknowledges the location of its campus on the traditional, unceded territories of the
Algonquin Anishinàbeg nation
</p>
Expand Down Expand Up @@ -192,8 +192,8 @@ export const FooterStandard = () => {
email
</LinkComponent>
</p>
<p>1125 Colonel By Drive, Ottawa, ON, K1S 5B6, Canada</p>
<ul className="flex justify-center gap-5 mb-4 lg:mb-0 lg:justify-end">
<p className="text-center">1125 Colonel By Drive, Ottawa, ON, K1S 5B6, Canada</p>
<ul className="flex flex-wrap justify-center gap-5 mb-4 lg:mb-0 lg:justify-end">
{Social.map((item, index) => (
<li key={index}>
<LinkComponent href={item.href} className="text-cu-black-300 hover:text-cu-red">
Expand Down
2 changes: 1 addition & 1 deletion lib/components/ImageGrid/ImageGrid.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { imageData } from '../../data/ImageData'
import { Section } from '../../layouts/Section/Section'

const meta: Meta<typeof ImageGrid> = {
title: 'Components/ImageGrid',
title: 'Components/Image Grid',
component: ImageGrid,
tags: ['autodocs'],
parameters: {
Expand Down
50 changes: 50 additions & 0 deletions lib/components/ImageSlider/ImageSlider.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import React from 'react'
import type { Meta, StoryObj } from '@storybook/react'
import { ImageSlider } from './ImageSlider'
import { sliderData } from '../../data/SliderData'

const meta: Meta<typeof ImageSlider> = {
title: 'Components/Image Slider',
component: ImageSlider,
tags: ['autodocs'],
parameters: {
controls: {
sort: 'requiredFirst',
},
},
}

export default meta
type Story = StoryObj<typeof ImageSlider>

export const Primary: Story = {
args: {
customClass: 'slider',
slidesPerViewMobile: 1,
slidesPerViewTablet: 3,
slidesPerViewDesktop: 4,
loop: true,
speed: 1000,
},
render: (args) => {
return (
<ImageSlider {...args}>
{sliderData.map((image, index) => {
const { image: imageUrl, title, link, focalPointX, focalPointY, aspectRatio } = image
return (
<ImageSlider.Item
key={index}
imageUrl={imageUrl}
title={title}
link={link}
focalPointX={focalPointX}
focalPointY={focalPointY}
aspectRatio={aspectRatio}
className={index == 0 ? `swiper-slide-active` : ``}
/>
)
})}
</ImageSlider>
)
},
}
56 changes: 56 additions & 0 deletions lib/components/ImageSlider/ImageSlider.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import { useEffect } from 'react'
import { ChevronLeftIcon, ChevronRightIcon } from '@heroicons/react/24/solid'
import { ImageSliderItem } from './ImageSliderItem'
import SwiperSlider from './script'

export interface ImageSliderProp {
children: React.ReactNode
loop?: boolean
speed?: number
slidesPerViewMobile?: number
slidesPerViewTablet?: number
slidesPerViewDesktop: number
customClass?: string
}

export const ImageSliderWrapper = ({
children,
loop = false,
speed = 500,
slidesPerViewMobile = 1,
slidesPerViewTablet = 2,
slidesPerViewDesktop = 3,
customClass,
}: ImageSliderProp) => {
useEffect(() => {
SwiperSlider()
}, [])

return (
<div
className={`swiper swiper--slider ${customClass ? customClass : ''}`}
data-swiper-class={`${customClass ? customClass : 'swiper'}`}
data-swiper-loop={loop}
data-swiper-speed={speed}
data-swiper-perview-mobile={slidesPerViewMobile}
data-swiper-perview-tablet={slidesPerViewTablet}
data-swiper-perview-desktop={slidesPerViewDesktop}
>
<div className="swiper-wrapper">{children}</div>
<div className="swiper__footer">
<button type="button" className="swiper__button swiper__button--prev" aria-label="Previous slide">
<ChevronLeftIcon className="w-8 h-8 [&>path]:stroke-[2]" aria-hidden="true" />
</button>
<button type="button" className="swiper__button swiper__button--next" aria-label="Next slide">
<ChevronRightIcon className="w-8 h-8 [&>path]:stroke-[2]" aria-hidden="true" />
</button>
</div>
</div>
)
}

export const ImageSlider = Object.assign(ImageSliderWrapper, {
Item: ImageSliderItem,
})

ImageSliderWrapper.displayName = 'ImageSlider'
57 changes: 57 additions & 0 deletions lib/components/ImageSlider/ImageSliderItem.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import { aspectRatioClasses } from '../../utils/propClasses'
import { useLinkContext } from '../LinkProvider/useLinkContext'

type aspectRatioKeys = keyof typeof aspectRatioClasses

export interface ImageSliderItemProps {
imageUrl: string
focalPointX?: number
focalPointY?: number
title?: string
link?: string
aspectRatio?: aspectRatioKeys
className?: string
}

export const ImageSliderItem = ({
imageUrl,
focalPointX = 50,
focalPointY = 50,
title,
link,
aspectRatio = 'landscape',
className,
}: ImageSliderItemProps) => {
const LinkComponent = useLinkContext()
const inlineImageStyles = {
backgroundImage: `url(${imageUrl})`,
backgroundPosition: `${focalPointX}% ${focalPointY}%`,
}

const classes = className ? `${className} swiper-slide` : 'swiper-slide'

return (
<div className={classes}>
<div
className={`relative ${aspectRatioClasses[aspectRatio]} bg-cover bg-center rounded-lg bg-black w-full h-full transition-[width] duration-[5000] ease-in-out`}
style={inlineImageStyles}
>
{title && (
<div
className={`bg-black/75 text-white absolute bottom-2 left-2 right-2 px-4 py-2.5 rounded-md ${link ? 'hover:bg-cu-red/85' : ''}`}
>
{link ? (
<LinkComponent href={link} className="cursor-pointer block hover-bg-cu-red">
<p className="text-sm md:text-base font-semibold line-clamp-2">{title}</p>
</LinkComponent>
) : (
<p className="text-sm md:text-base font-semibold line-clamp-2">{title}</p>
)}
</div>
)}
</div>
</div>
)
}

ImageSliderItem.displayName = 'ImageSlider.Item'
49 changes: 49 additions & 0 deletions lib/components/ImageSlider/script.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import Swiper from 'swiper/bundle'

const SwiperSlider = () => {
const SwiperSliders = document.querySelectorAll('.swiper--slider')

if (SwiperSliders.length === 0) return

SwiperSliders.forEach((SwiperSlider) => {
const swiperClass = SwiperSlider.getAttribute('data-swiper-class')

if (swiperClass) {
const classname = `.${swiperClass}`
const swiperLoop = SwiperSlider.getAttribute('data-swiper-loop') === 'true'
const swiperSpeed = SwiperSlider.getAttribute('data-swiper-speed') || '500'
const swiperSlidesPerViewMobile = SwiperSlider.getAttribute('data-swiper-perview-mobile') || '1'
const swiperSlidesPerViewTablet = SwiperSlider.getAttribute('data-swiper-perview-tablet') || '3'
const swiperSlidesPerViewDesktop = SwiperSlider.getAttribute('data-swiper-perview-desktop') || '4'

new Swiper(classname, {
a11y: {
prevSlideMessage: 'Previous slide',
nextSlideMessage: 'Next slide',
},
updateOnWindowResize: true,
loop: swiperLoop,
speed: parseInt(swiperSpeed),
slidesPerView: parseInt(swiperSlidesPerViewMobile),
spaceBetween: 8,
breakpoints: {
768: {
// slidesPerView: 'auto',
slidesPerView: parseInt(swiperSlidesPerViewTablet),
},
1024: {
slidesPerView: parseInt(swiperSlidesPerViewDesktop),
},
},
centeredSlides: true,
pagination: false,
navigation: {
nextEl: '.swiper__button--next',
prevEl: '.swiper__button--prev',
},
})
}
})
}

export default SwiperSlider
15 changes: 15 additions & 0 deletions lib/components/ImageSlider/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.swiper .swiper-slide {
@apply relative md:w-[250px] lg:w-[300px] md:h-[250px] lg:h-[300px] rounded-lg my-auto transition-[width] duration-[5000] ease-in-out;
}

.swiper .swiper-slide.swiper-slide-active {
@apply relative md:w-[300px] lg:w-[400px] md:h-[300px] lg:h-[400px] transition-[width] duration-[5000] ease-in-out;
}

.swiper__footer {
@apply flex gap-6 items-center justify-center mt-4 md:mt-8;
}

.swiper__button {
@apply bg-cu-black-800 text-white hover:bg-cu-red text-2xl relative flex items-center justify-center rounded-full p-1 h-12 w-12 z-50;
}
46 changes: 16 additions & 30 deletions lib/components/Nav/NavLogo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,36 +10,22 @@ export const NavLogo = ({ title, link }: NavLogoProps) => {

return (
<div className="cu-nav__top flex items-center py-3.5 gap-5 md:gap-8 shrink-1 md:shrink-0 max-sm:grow">
{title && link && (
<a href="https://carleton.ca" className="shrink-0">
<img
className="w-[148px] h-[40px] shrink-0 hidden md:block"
src="https://cu-production.s3.amazonaws.com/rds/assets/cu-logos/cu-logo-color-right-horiztonal.svg"
width="148"
height="40"
alt="Carleton University Logo"
/>
<img
className="w-[30px] h-[38px] shrink-0 md:hidden"
src="https://cu-production.s3.amazonaws.com/rds/assets/cu-logos/cu-shield-color.svg"
width="30"
height="38"
alt="Carleton University Logo"
/>
</a>
)}

{!title && (
<a href="https://carleton.ca" className="shrink-0">
<img
className="w-[148px] h-[40px] shrink-0"
src="https://cu-production.s3.amazonaws.com/rds/assets/cu-logos/cu-logo-color-right-horiztonal.svg"
width="148"
height="40"
alt="Logo"
/>
</a>
)}
<a href="https://carleton.ca" className="shrink-0">
<img
className={`w-[148px] h-[40px] shrink-0 ${title ? 'hidden md:block' : 'block'}`}
src="https://cu-production.s3.amazonaws.com/rds/assets/cu-logos/cu-logo-color-right-horiztonal.svg"
width="148"
height="40"
alt="Carleton University Logo"
/>
<img
className={`w-[30px] h-[38px] shrink-0 ${title ? 'block md:hidden' : 'hidden'}`}
src="https://cu-production.s3.amazonaws.com/rds/assets/cu-logos/cu-shield-color.svg"
width="30"
height="38"
alt="Carleton University Logo"
/>
</a>

{title && link && (
<div className="leading-none max-w-[60%] sm:max-w-[200px] md:max-w-[220px]">
Expand Down
6 changes: 3 additions & 3 deletions lib/data/FooterStandardData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ export const FooterStandardLinks = {
],
Academics: [
{ name: 'Schedules & Dates', href: 'https://carleton.ca/academics/schedules-dates/' },
{ name: 'Bightspace', href: 'https://brightspace.carleton.ca/' },
{ name: 'Brightspace', href: 'https://brightspace.carleton.ca/' },
{ name: 'Library', href: 'https://library.carleton.ca/' },
{ name: 'Support Services', href: 'https://carleton.ca/academics/support/' },
{ name: 'Calendars', href: 'https://calendar.carleton.ca/' },
{ name: 'Carleton Online', href: 'https://carleton.ca/cuol/' },
{ name: 'Carleton Online', href: 'https://carleton.ca/online/' },
{ name: 'Future Learning Lab', href: 'https://carleton.ca/tls/future-learning-lab/' },
],
Students: [
Expand All @@ -33,7 +33,7 @@ export const FooterStandardLinks = {
{ name: 'Parking', href: 'https://carleton.ca/parking/' },
{ name: 'Safety', href: 'https://carleton.ca/safety/' },
{ name: 'Dining Services', href: 'https://dining.carleton.ca/' },
{ name: 'Clubs & Societies', href: 'https://cusaonline.ca/clubs/' },
{ name: 'Clubs & Societies', href: 'https://www.cusaclubs.ca/' },
],
Ravens: [
{ name: 'Giving to Carleton', href: 'https://futurefunder.carleton.ca/' },
Expand Down
Loading

0 comments on commit 3d61826

Please sign in to comment.