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

Basic carousel for new site #42

Merged
merged 17 commits into from
Nov 6, 2024
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 .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
Expand Down
77 changes: 74 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,27 @@
"@trussworks/react-uswds": "^9.1.0",
"@uswds/uswds": "^3.9.0",
"classnames": "^2.5.1",
"fs": "^0.0.1-security",
"gray-matter": "^4.0.3",
"next": "14.2.15",
"path": "^0.12.7",
"react": "^18.3.1",
"react-dom": "^18",
"react-markdown": "^9.0.1"
"react-markdown": "^9.0.1",
"react-slick": "^0.30.2",
"slick-carousel": "^1.8.1"
},
"devDependencies": {
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
"@types/react-slick": "^0.23.13",
"autoprefixer": "^10.4.20",
"eslint": "^8.57.1",
"eslint-config-next": "14.2.15",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-react": "^7.37.2",
"fs": "^0.0.1-security",
"husky": "^9.1.6",
"lint-staged": "^15.2.10",
"postcss": "^8",
Expand Down
Binary file added public/images/placeholder-carousel-numbered-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/placeholder-carousel-numbered-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/placeholder-carousel-numbered-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/placeholder-carousel-numbered-4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/placeholder-carousel-numbered-5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/placeholder-carousel-numbered-6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/placeholder-carousel-numbered-7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions public/images/placeholder-carousel.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
54 changes: 54 additions & 0 deletions src/app/components/Carousel/Carousel.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
'use client';
import Slider from 'react-slick';
import { basePath } from '../../utils/constants';
import Image from 'next/image';
import 'slick-carousel/slick/slick.css';
import 'slick-carousel/slick/slick-theme.css';

export default function Carousel() {
const images = [
`${basePath}/images/placeholder-carousel-numbered-1.png`,
`${basePath}/images/placeholder-carousel-numbered-2.png`,
`${basePath}/images/placeholder-carousel-numbered-3.png`,
`${basePath}/images/placeholder-carousel-numbered-4.png`,
`${basePath}/images/placeholder-carousel-numbered-5.png`,
`${basePath}/images/placeholder-carousel-numbered-6.png`,
`${basePath}/images/placeholder-carousel-numbered-7.png`,
`${basePath}/images/placeholder-carousel-numbered-1.png`,
`${basePath}/images/placeholder-carousel-numbered-2.png`,
`${basePath}/images/placeholder-carousel-numbered-3.png`,
`${basePath}/images/placeholder-carousel-numbered-4.png`,
`${basePath}/images/placeholder-carousel-numbered-5.png`,
`${basePath}/images/placeholder-carousel-numbered-6.png`,
`${basePath}/images/placeholder-carousel-numbered-7.png`,
];

const settings = {
infinite: true,
speed: 15000, // Adjust speed to make it constant
slidesToShow: 7, // Number of visible slides
slidesToScroll: 1,
autoplay: true,
autoplaySpeed: 0, // Continuous without pause
cssEase: 'linear', // For smooth, continuous movement
pauseOnHover: false,
};

return (
<div className={'sliderContainer'}>
<Slider {...settings}>
{images.map((src, index) => (
<div key={index}>
<Image
src={src}
alt={`Slide ${index + 1}`}
width={160}
height={100}
draggable={false}
/>
</div>
))}
</Slider>
</div>
);
}
6 changes: 4 additions & 2 deletions src/app/components/ContentContainer/ContentContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@ interface ContentContainerProps {
export function ContentContainer({
children,
align = false,
classes = 'ml-auto mr-auto flex max-w-[87.5rem] flex-col px-10 py-4 sm:px-14 sm:py-20',
classes = '',
}: ContentContainerProps) {
const defaultClasses =
'ml-auto mr-auto flex max-w-[87.5rem] flex-col px-10 py-4 sm:px-14 sm:py-20';
return (
<section>
<div
className={classNames(classes, {
className={classNames(defaultClasses, classes, {
'md:px-32': !align,
})}
>
Expand Down
1 change: 1 addition & 0 deletions src/app/custom-styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
--foreground: #171717;
--header-teal: #224a58;
--background-light-blue: #dcecf3;
--ifm-color-primary: #2e8555;
font-size: 16px; /* base value for rem */
}

Expand Down
30 changes: 20 additions & 10 deletions src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Grid, GridContainer } from '@trussworks/react-uswds';
import Image from 'next/image';
import { basePath } from './utils/constants';
import Carousel from './components/Carousel/Carousel';
import Hero from './components/Hero/Hero';
import { ContentContainer } from './components/ContentContainer/ContentContainer';
import Link from 'next/link';
Expand Down Expand Up @@ -105,17 +106,26 @@ function SectionTwo() {

function SectionThree() {
return (
<ContentContainer align>
<div className="flex flex-col items-center">
<h2 className="text-center text-[2rem] font-bold text-[#224a58]">
Jurisdictions working with DIBBs
</h2>
<p className="text-center text-base font-normal leading-relaxed text-[#224a58]">
State and local public health jurisdictions across the United States
used DIBBs to solve their toughest data challenges
</p>
<>
<ContentContainer align classes="px-14 pt-20 pb-10 sm:pb-10">
<Grid row gap>
<Grid col={12}>
<div className="flex flex-col items-center">
<h2 className="text-center text-[2rem] font-bold text-[#224a58]">
Jurisdictions working with DIBBs
</h2>
<p className="text-center text-base font-normal leading-relaxed text-[#224a58]">
State and local public health jurisdictions across the United
States used DIBBs to solve their toughest data challenges
</p>
</div>
</Grid>
</Grid>
</ContentContainer>
<div className="pb-20 pt-0">
<Carousel />
</div>
</ContentContainer>
</>
);
}

Expand Down
6 changes: 0 additions & 6 deletions src/content/homepage/section_1.md

This file was deleted.

13 changes: 0 additions & 13 deletions src/content/homepage/section_2.md

This file was deleted.

6 changes: 0 additions & 6 deletions src/content/homepage/section_3.md

This file was deleted.

6 changes: 0 additions & 6 deletions src/content/homepage/section_4.md

This file was deleted.

Loading