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

changed columns from 3 to 2,added vertical spacing in mobile view #3511

Closed
Closed
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
36 changes: 19 additions & 17 deletions components/CaseStudyCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,24 @@ export default function CaseStudyCard({ studies = [] }: ICaseStudyCardProps) {
}

return (
<div className='flex flex-wrap pt-10 lg:grid lg:grid-cols-3 lg:gap-8 lg:text-center'>
{studies.map((study, index) => (
<a key={index} href={`casestudies/${study.id}`}>
<div
className='max-w-sm overflow-hidden rounded-md border border-gray-200 bg-white p-4'
data-testid='CaseStudyCard-main'
>
<span className='mr-2'>
<img className='m-auto h-16' src={study.company.logo} alt={study.company.name} />
</span>
<Paragraph typeStyle={ParagraphTypeStyle.md} className='my-4'>
{study.company.description}
</Paragraph>
</div>
</a>
))}
</div>
<div className="grid gap-y-4 pt-10 sm:gap-y-6 lg:grid-cols-2 lg:gap-y-8 lg:justify-items-center lg:gap-x-0">
{studies.map((study, index) => (
<a key={index} href={`casestudies/${study.id}`} className="w-full max-w-sm">
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Avoid using array index as key prop

Using array indices as keys can lead to issues with component state and performance when the list items are reordered, removed, or inserted.

Consider using a unique identifier from the study object:

-    <a key={index} href={`casestudies/${study.id}`} className="w-full max-w-sm">
+    <a key={study.id} href={`casestudies/${study.id}`} className="w-full max-w-sm">
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<a key={index} href={`casestudies/${study.id}`} className="w-full max-w-sm">
<a key={study.id} href={`casestudies/${study.id}`} className="w-full max-w-sm">
🧰 Tools
🪛 eslint

[error] 24-24: Replace ····<a·key={index}·href={casestudies/${study.id}}·className="w-full·max-w-sm" with ········<a·key={index}·href={casestudies/${study.id}}·className='w-full·max-w-sm'

(prettier/prettier)


[error] 24-24: Unexpected usage of doublequote.

(jsx-quotes)

<div
className="flex flex-col items-center h-full overflow-hidden rounded-md border border-gray-200 bg-white p-4 transform transition-transform duration-300 hover:scale-105 hover:shadow-lg"
style={{ minHeight: '300px' }}
data-testid="CaseStudyCard-main"
>
<span className="mr-2">
<img className="m-auto h-16" src={study.company.logo} alt={study.company.name} />
</span>
Comment on lines +30 to +32
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Remove unnecessary span wrapper

The span with mr-2 class appears to serve no purpose as it's the only child in a centered flex container.

-        <span className="mr-2"> 
-          <img className="m-auto h-16" src={study.company.logo} alt={study.company.name} />
-        </span>
+        <img className="m-auto h-16" src={study.company.logo} alt={study.company.name} />
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<span className="mr-2">
<img className="m-auto h-16" src={study.company.logo} alt={study.company.name} />
</span>
<img className="m-auto h-16" src={study.company.logo} alt={study.company.name} />
🧰 Tools
🪛 eslint

[error] 30-30: Replace ········<span·className="mr-2">· with ············<span·className='mr-2'>

(prettier/prettier)


[error] 30-30: Unexpected usage of doublequote.

(jsx-quotes)


[error] 30-30: Trailing spaces not allowed.

(no-trailing-spaces)


[error] 31-31: Replace ··········<img·className="m-auto·h-16" with ··············<img·className='m-auto·h-16'

(prettier/prettier)


[error] 31-31: Unexpected usage of doublequote.

(jsx-quotes)


[error] 32-32: Replace ········ with ············

(prettier/prettier)

<Paragraph typeStyle={ParagraphTypeStyle.md} className="my-4 text-center">
{study.company.description}
</Paragraph>
</div>
</a>
))}
</div>

);
}
Loading