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 12 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.
11 changes: 11 additions & 0 deletions src/app/components/Carousel/Carousel.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.sliderContainer {
h3 {
font-size: 36px;
margin: 10px;
padding: 2% 0;
background: var(--ifm-color-primary);
color: #fff;
line-height: 100px;
text-align: center;
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still need these styles? Looks like maybe not.

53 changes: 53 additions & 0 deletions src/app/components/Carousel/Carousel.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
'use client';
import Slider from 'react-slick';
import styles from './Carousel.module.scss';
import { basePath } from '../../utils/constants';
import Image from 'next/image';

export default function SimpleSlider() {
nickbristow marked this conversation as resolved.
Show resolved Hide resolved
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={styles.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>
);
}
4 changes: 3 additions & 1 deletion src/app/components/ContentContainer/ContentContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,17 @@ import classNames from 'classnames';
interface ContentContainerProps {
children: React.ReactNode;
align?: boolean;
classes?: string;
}
export function ContentContainer({
children,
align = false,
classes = 'px-14 py20',
}: ContentContainerProps) {
return (
<section>
<GridContainer
className={classNames('px-14 py-20', {
className={classNames(classes, {
'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
2 changes: 2 additions & 0 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import Header from './components/Header/Header';
import Footer from './components/Footer/Footer';
import USABanner from './components/UsaBanner/UsaBanner';
import { basePath } from './utils/constants';
import 'slick-carousel/slick/slick.css';
import 'slick-carousel/slick/slick-theme.css';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could move these two imports into Carousel.tsx?

import './globals.scss';
import './custom-styles.css';

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 SimpleCarousel 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">
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please double check that your styling still works here once you merge #41 in 😃

<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-10">
<SimpleCarousel />
</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