-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Overengineered a solution to image width problems on mobile
- Loading branch information
1 parent
4cdfdc5
commit b6d89b2
Showing
2 changed files
with
34 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import React from 'react'; | ||
|
||
interface DiagramProps { | ||
src: string; | ||
title?: string; | ||
description?: string; | ||
} | ||
|
||
const Diagram: React.FC<DiagramProps> = ({ src, title, description }) => { | ||
if (!src) { | ||
console.error('Diagram component requires a valid src string.'); | ||
return null; | ||
} | ||
|
||
return ( | ||
<div className="flex flex-col items-center"> | ||
<img src={src} alt={title || 'Diagram'} className="max-w-full h-auto" /> | ||
{(title || description) && ( | ||
<p className="text-center text-sm mt-2"> | ||
{title && <strong>{title}</strong>} | ||
{title && description && ': '} | ||
{description} | ||
</p> | ||
)} | ||
</div> | ||
); | ||
}; | ||
|
||
export default Diagram; |