Skip to content
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
92 changes: 61 additions & 31 deletions pages/casestudies/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,38 +82,68 @@ export default function Casestudies() {
</div>
</div>

<center>
<div className='overflow-x-auto'>
<table className='my-8 w-full max-w-full border-collapse border'>
<thead>
<tr>
<th className='border p-2 font-bold'>Company name</th>
<th className='border-2 p-2 font-bold'>Use Case</th>
<th className='border-2 p-2 font-bold'>Resources</th>
{/* Desktop Table View */}
<div className='hidden md:block overflow-x-auto'>
<table className='my-8 w-full border-collapse border table-auto'>
<thead>
<tr>
<th className='border p-2 font-bold'>Company name</th>
<th className='border-2 p-2 font-bold'>Use Case</th>
<th className='border-2 p-2 font-bold'>Resources</th>
</tr>
</thead>
<tbody>
{AdoptersList.map((entry: Adopter, index: number) => (
Copy link
Member

Choose a reason for hiding this comment

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

what does number signify here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

index: number explicitly documents that the map callback’s second argument is a 0-based numeric index, improving readability and type safety (even though TypeScript could infer it).

<tr key={index} data-testid='Adopters'>
<td className='border-2 p-2'>{entry.companyName}</td>
<td className='border-2 p-2'>{entry.useCase}</td>
<td className='border-2 p-2'>
<ul className='space-y-1'>
{entry.resources.map((resource: Resource, resourceIndex: number) => (
<li key={resourceIndex}>
<a className='text-cyan-500 underline hover:text-cyan-600' href={resource.link}>
{resource.title}
</a>
</li>
))}
</ul>
</td>
</tr>
</thead>
<tbody>
{AdoptersList.map((entry: Adopter, index: number) => (
<tr key={index} data-testid='Adopters'>
<td className='border-2 p-2'>{entry.companyName}</td>
<td className='border-2 p-2'>{entry.useCase}</td>
<td className='border-2 p-2'>
<ul>
{entry.resources.map((resource: Resource, resourceIndex: number) => (
<li className='p-2' key={resourceIndex}>
<a className='text-cyan-500 underline' href={resource.link}>
{resource.title}
</a>
</li>
))}
</ul>
</td>
</tr>
))}
</tbody>
</table>
</div>
</center>
))}
</tbody>
</table>
</div>

{/* Mobile Card View */}
<div className='md:hidden my-8 space-y-4'>
{AdoptersList.map((entry: Adopter, index: number) => (
<div
key={index}
className='border border-gray-300 rounded-lg p-4 bg-white shadow-sm'
data-testid='Adopters'
>
<div className='mb-3'>
<h3 className='font-bold text-lg text-gray-900'>{entry.companyName}</h3>
</div>
<div className='mb-3'>
<h4 className='font-semibold text-sm text-gray-700 mb-1'>Use Case:</h4>
<p className='text-gray-600 text-sm'>{entry.useCase}</p>
</div>
<div>
<h4 className='font-semibold text-sm text-gray-700 mb-2'>Resources:</h4>
<ul className='space-y-1'>
{entry.resources.map((resource: Resource, resourceIndex: number) => (
<li key={resourceIndex}>
Copy link
Member

Choose a reason for hiding this comment

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

what are the things we are mapping in resources

Copy link
Contributor Author

Choose a reason for hiding this comment

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

  • Each adopter has a list of “resources” in config/adopters.json.

  • Every resource has two fields:

  1. title: what we show as the link text (e.g., “Blog post”, “GitHub repo”)
  2. link: the URL the user goes to when they click
  • On the Case Studies page, we loop through "entry.resources" and render each one as a link.

<a className='text-cyan-500 underline hover:text-cyan-600 text-sm' href={resource.link}>
{resource.title}
</a>
</li>
))}
</ul>
</div>
</div>
))}
</div>
</div>
</GenericLayout>
);
Expand Down
13 changes: 3 additions & 10 deletions pages/tools/generator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,13 @@ import Paragraph from '../../components/typography/Paragraph';
*/
function renderButtons(): React.JSX.Element {
return (
<div className='mt-8 flex flex-wrap gap-4'>
{/* <Button
text="Learn more"
href="/docs/tools/generator"
iconPosition="left"
icon={<IconRocket className="inline-block w-6 h-6 -mt-1" />}
className="w-full mb-2 sm:w-auto sm:mb-0 sm:mr-2"
/> */}
<div className='mt-8 flex flex-col gap-4 md:flex-row md:flex-wrap md:justify-center lg:justify-start'>
<GithubButton
text='View on Github'
className='w-full text-center sm:w-fit sm:text-left'
className='w-full text-center md:w-auto md:text-left'
href='https://www.github.com/asyncapi/generator'
/>
<Button text='View Docs' href='/docs/tools/generator' className='w-full text-center sm:w-fit sm:text-left' />
<Button text='View Docs' href='/docs/tools/generator' className='w-full text-center md:w-auto md:text-left' />
</div>
);
}
Expand Down
Loading