Skip to content

Commit

Permalink
[FIX] Unique Key Error with .map
Browse files Browse the repository at this point in the history
  • Loading branch information
carms-ng committed Apr 1, 2021
1 parent 0bf6b5c commit 148f863
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 15 deletions.
6 changes: 0 additions & 6 deletions src/assets/content/team.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,6 @@
"github": "https://github.com/",
"image": "002_jeremy_viau_trudel.jpg",
"highlights": [
"Some hightlight",
"Some hightlight",
"Some hightlight",
"Some hightlight",
"Some hightlight",
"Some hightlight",
"Some hightlight"
]
}
Expand Down
10 changes: 4 additions & 6 deletions src/components/carousel-card.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import { FiLinkedin, FiGithub, FiChevronLeft, FiChevronRight } from 'react-icons
import Img from 'gatsby-image';
import team from '../assets/content/team.json';



export default function CarouselCard({pic, index, count, activeIndex, setActiveIndex}) {
// handle carousel navigation
const handlePrev = () => {
Expand Down Expand Up @@ -47,7 +45,7 @@ export default function CarouselCard({pic, index, count, activeIndex, setActiveI
<ul className="py-4 hidden md:block">
{person.highlights.map(hl => {
return (
<li>
<li key={hl}>
<Trans>{hl}</Trans>
</li>
)
Expand All @@ -56,9 +54,9 @@ export default function CarouselCard({pic, index, count, activeIndex, setActiveI
</div>
</div>
<ul className="py-4 block md:hidden">
{person.highlights.map(hl => {
{person.highlights.map((hl, i) => {
return (
<li>
<li key={hl + i}>
<Trans>{hl}</Trans>
</li>
)
Expand Down Expand Up @@ -102,7 +100,7 @@ const CarouselCardStyles = styled.div`
color: var(--darkgrey);
}
a svg:hover {
color: var(--red);
color: var(--black);
}
.carousel-btns {
position: absolute;
Expand Down
3 changes: 2 additions & 1 deletion src/components/carousel.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export default function Carousel() {
...GatsbyImageSharpFluid
}
}
id
}
}
}
Expand All @@ -30,7 +31,7 @@ export default function Carousel() {
return (
<>
{pics.map((pic, index) => {
return (<CarouselCard pic={pic} key={pic.node.base} index={index} count={pics.length} activeIndex={activeIndex} setActiveIndex={setActiveIndex}/>)
return (<CarouselCard pic={pic} key={pic.node.id} index={index} count={pics.length} activeIndex={activeIndex} setActiveIndex={setActiveIndex}/>)
})}

</>
Expand Down
5 changes: 3 additions & 2 deletions src/components/logo-garden.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export default function LogoGarden() {
fluid(maxWidth: 500, quality: 80) {
...GatsbyImageSharpFluid
}
id
}
}
}
Expand All @@ -61,12 +62,12 @@ export default function LogoGarden() {
<Trans>Trusted by these partners and clients</Trans>
</p>
<div className="logos">
{logos.map(({ node }) => (
{logos.map(({node}) => (
<Img
imgStyle={{ width: `auto`, height: `auto`, top: `50%`, left: `50%`, transform: `translate(-50%, -50%)`}}
className="m-4"
fluid={node.childImageSharp.fluid}
key={node.base}
key={node.childImageSharp.id}
alt={node.base.split('.')[0]}
/>
))}
Expand Down
2 changes: 2 additions & 0 deletions src/components/stacked-avatar.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export default function StackedAvatar() {
fixed(width: 200) {
...GatsbyImageSharpFixed
}
id
}
}
}
Expand All @@ -35,6 +36,7 @@ export default function StackedAvatar() {
fixed={pic.node.childImageSharp.fixed}
style={{width: `75px`, height: `75px`, zIndex: `${zIndex}`, border: `1px solid var(--white)`, transform: `translateX(${translateX}%)`}}
imgStyle={{objectPosition: `top center`}}
key={pic.node.childImageSharp.id}
/>
)
})}
Expand Down

0 comments on commit 148f863

Please sign in to comment.