-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
292 additions
and
62 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
src/renderer/components/extension-manager/extension-card.component.scss
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,24 @@ | ||
.extension-card-wide { | ||
display: flex; | ||
width: 100%; | ||
justify-content: space-between; | ||
} | ||
|
||
.extension-card-square { | ||
display: flex; | ||
flex-direction: column; | ||
min-width: 250px; | ||
max-width: 300px; | ||
width: 100%; | ||
} | ||
|
||
.card-action-square { | ||
justify-content: space-between; | ||
} | ||
|
||
.extension-card-description { | ||
flex-grow: 1; | ||
// Only set important here because MUI forces padding on each Card element | ||
// Didn't need all the padding at the top to match UX mockup, intended to change later | ||
padding-top: 0 !important; | ||
} |
75 changes: 75 additions & 0 deletions
75
src/renderer/components/extension-manager/extension-card.component.tsx
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,75 @@ | ||
import { Avatar, Card, CardActions, CardContent, CardHeader, Typography } from '@mui/material'; | ||
import { PropsWithChildren, ReactNode, useMemo } from 'react'; | ||
import './extension-card.component.scss'; | ||
|
||
export type ExtensionCardProps = PropsWithChildren<{ | ||
/** | ||
* The unique extension name | ||
*/ | ||
extensionName: string; | ||
|
||
/** | ||
* The description of the extension | ||
*/ | ||
extensionDescription: string; | ||
|
||
/** | ||
* File path to the icon | ||
*/ | ||
iconFilePath?: string; | ||
|
||
/** | ||
* Content to provide for a header action that appears in the top right of the Card | ||
*/ | ||
headerAction?: ReactNode; | ||
|
||
/** | ||
* Optional className to link to css | ||
*/ | ||
className?: string; | ||
}>; | ||
|
||
export default function ExtensionCard({ | ||
extensionName, | ||
extensionDescription, | ||
iconFilePath, | ||
headerAction, | ||
className, | ||
children, | ||
}: ExtensionCardProps) { | ||
const avatar = useMemo( | ||
() => ( | ||
<Avatar variant="square" src={iconFilePath ?? undefined} alt={extensionDescription}> | ||
{!iconFilePath ? extensionName[0] : null} | ||
</Avatar> | ||
), | ||
[extensionDescription, extensionName, iconFilePath], | ||
); | ||
|
||
const isGallery = useMemo(() => className && className === 'square', [className]); | ||
|
||
return ( | ||
<Card | ||
className={isGallery ? 'extension-card-square' : 'extension-card-wide'} | ||
variant="outlined" | ||
> | ||
<CardHeader | ||
className="extension-card-content" | ||
avatar={avatar} | ||
title={extensionName} | ||
titleTypographyProps={{ variant: 'h6' }} | ||
action={headerAction} | ||
subheader={!isGallery ? extensionDescription : null} | ||
subheaderTypographyProps={{ variant: 'body2' }} | ||
/> | ||
{isGallery ? ( | ||
<CardContent className="extension-card-description"> | ||
<Typography variant="body2">{extensionDescription}</Typography> | ||
</CardContent> | ||
) : null} | ||
<CardActions className={isGallery ? 'card-action-square' : 'card-action-wide'}> | ||
{children} | ||
</CardActions> | ||
</Card> | ||
); | ||
} |
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
21 changes: 17 additions & 4 deletions
21
src/renderer/components/extension-manager/extension-manager-tab.component.scss
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 |
---|---|---|
@@ -1,8 +1,21 @@ | ||
.installed-extensions-list { | ||
.extension-manager-dialog { | ||
overflow-y: auto; | ||
display: flex; | ||
flex-direction: column; | ||
align-items: flex-end; | ||
padding: 5%; | ||
gap: 10px; | ||
flex-direction: column; | ||
} | ||
|
||
.extension-manager-label { | ||
padding-bottom: 5%; | ||
} | ||
|
||
.extension-manager-actions { | ||
padding-top: 5%; | ||
align-self: flex-end; | ||
} | ||
|
||
.extension-manager-instance { | ||
display: flex; | ||
flex-direction: column; | ||
gap: 30px; | ||
} |
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
6 changes: 3 additions & 3 deletions
6
src/renderer/components/extension-manager/extension-toggle.component.scss
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
.extension-card { | ||
.switch-container { | ||
display: flex; | ||
width: 100%; | ||
justify-content: space-between; | ||
justify-content: flex-end; | ||
align-items: center; | ||
} |
Oops, something went wrong.