Skip to content

Commit

Permalink
🎨 style: improve formatting and comments in LinkContent component
Browse files Browse the repository at this point in the history
  • Loading branch information
kjy5 authored and gitbutler-client committed Feb 13, 2024
1 parent b18a809 commit dbb9840
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions src/components/link-card.tsx
Original file line number Diff line number Diff line change
@@ -1,30 +1,38 @@
import { LinkMeta } from '../models/artifact-meta-models.ts';
import { Avatar, Card, CardActionArea, CardContent, CardMedia, Link, Stack, Typography } from '@mui/material';
import {LinkMeta} from '../models/artifact-meta-models.ts';
import {Avatar, Card, CardActionArea, CardContent, CardMedia, Link, Stack, Typography} from '@mui/material';

function LinkContent(props: { title: string; description: string; faviconSrc: string; domain: string }) {
/**
* Content of a link.
* @param title The title of the link.
* @param description The description of the link.
* @param faviconSrc The favicon of the link.
* @param domain The domain of the link.
* @constructor
*/
function LinkContent({title, description, faviconSrc, domain}: { title: string; description: string; faviconSrc: string; domain: string }) {
return (
<CardContent>
<Stack spacing={2}>
<Typography gutterBottom variant="h5" component="div">
{props.title}
{title}
</Typography>

<Typography variant="body2" color="text.secondary">
{props.description}
{description}
</Typography>

<Stack direction={'row'} spacing={2} alignItems={'center'}>
{props.faviconSrc && <Avatar src={props.faviconSrc} />}
<Link href={`https://${props.domain}`}>{props.domain}</Link>
{faviconSrc && <Avatar src={faviconSrc} />}
<Link href={`https://${domain}`}>{domain}</Link>
</Stack>
</Stack>
</CardContent>
);
}

/**
* Visual organization of a hyperlink.
* @param linkMeta The metadata of the hyperlink.
* Rich representation of a link.
* @param linkMeta The metadata of the link.
* @constructor
*/
function LinkCard({ linkMeta }: { linkMeta: LinkMeta }) {
Expand Down

0 comments on commit dbb9840

Please sign in to comment.