generated from kubefirst/react-app-template
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: marketplace * feat: marketplace + api integration * feat: marketplace flow * feat: marketplace api integration refactor * feat: error handling and git validations * fix: marketplace notification
- Loading branch information
1 parent
37b9c9f
commit c11e9d8
Showing
53 changed files
with
1,200 additions
and
516 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
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
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
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,50 @@ | ||
import React, { FunctionComponent, PropsWithChildren } from 'react'; | ||
import Image from 'next/image'; | ||
|
||
import Tag from '../tag'; | ||
import { MarketplaceApp } from '../../types/marketplace'; | ||
import Button from '../../components/button'; | ||
import Typography from '../typography'; | ||
import { VOLCANIC_SAND } from '../../constants/colors'; | ||
|
||
import { Card, Description, Header } from './marketplaceCard.styled'; | ||
|
||
export interface MarketplaceCardProps extends MarketplaceApp { | ||
onClick?: () => void; | ||
showSubmitButton?: boolean; | ||
} | ||
|
||
const MarketplaceCard: FunctionComponent<PropsWithChildren<MarketplaceCardProps>> = ({ | ||
name, | ||
categories, | ||
image_url, | ||
description, | ||
onClick, | ||
showSubmitButton = true, | ||
children, | ||
}) => { | ||
return ( | ||
<Card> | ||
<Header> | ||
<Image alt={name} height={28} width={28} src={image_url} style={{ objectFit: 'contain' }} /> | ||
<Typography | ||
variant="buttonSmall" | ||
sx={{ textTransform: 'capitalize' }} | ||
color={VOLCANIC_SAND} | ||
> | ||
{name} | ||
</Typography> | ||
{categories && | ||
categories.map((category) => <Tag key={category} text={category} bgColor="purple" />)} | ||
</Header> | ||
<Description variant="body2">{description || children}</Description> | ||
{showSubmitButton && ( | ||
<Button variant="outlined" color="secondary" onClick={onClick}> | ||
Add | ||
</Button> | ||
)} | ||
</Card> | ||
); | ||
}; | ||
|
||
export default MarketplaceCard; |
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,33 @@ | ||
import styled from 'styled-components'; | ||
|
||
import Typography from '../../components/typography'; | ||
|
||
export const Card = styled.div` | ||
background-color: ${({ theme }) => theme.colors.white}; | ||
border: 1px solid ${({ theme }) => theme.colors.pastelLightBlue}; | ||
border-radius: 12px; | ||
height: 194px; | ||
padding: 24px; | ||
width: 372px; | ||
`; | ||
|
||
export const Description = styled(Typography)` | ||
color: ${({ theme }) => theme.colors.saltboxBlue}; | ||
height: 100px; | ||
margin: 16px 0; | ||
& a { | ||
color: ${({ theme }) => theme.colors.primary}; | ||
text-decoration: none; | ||
} | ||
& a:hover { | ||
text-decoration: underline; | ||
} | ||
`; | ||
|
||
export const Header = styled.div` | ||
align-items: center; | ||
display: flex; | ||
gap: 16px; | ||
`; |
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,86 @@ | ||
import React, { FunctionComponent } from 'react'; | ||
import { Box, Divider } from '@mui/material'; | ||
import Image from 'next/image'; | ||
import { Control } from 'react-hook-form'; | ||
|
||
import Modal from '../modal'; | ||
import Button from '../button'; | ||
import Typography from '../typography'; | ||
import ControlledPassword from '../controlledFields/Password'; | ||
import { MarketplaceApp } from '../../types/marketplace'; | ||
import { BISCAY, SALTBOX_BLUE } from '../../constants/colors'; | ||
|
||
import { Content, Close, Footer, Header } from './marketplaceModal.styled'; | ||
|
||
export interface MarketplaceModalProps extends MarketplaceApp { | ||
control: Control; | ||
isOpen: boolean; | ||
isValid: boolean; | ||
closeModal: () => void; | ||
onSubmit: (app: MarketplaceApp) => void; | ||
} | ||
|
||
const MarketplaceModal: FunctionComponent<MarketplaceModalProps> = ({ | ||
control, | ||
closeModal, | ||
isOpen, | ||
isValid, | ||
name, | ||
image_url, | ||
secret_keys, | ||
onSubmit, | ||
...rest | ||
}) => { | ||
const handleSubmit = () => { | ||
onSubmit({ name, image_url, secret_keys, ...rest }); | ||
}; | ||
|
||
return ( | ||
<Modal isOpen={isOpen} padding={0}> | ||
<Box | ||
sx={{ | ||
width: '630px', | ||
height: 'auto', | ||
backgroundColor: 'white', | ||
borderRadius: '8px', | ||
boxShadow: '0px 2px 4px rgba(100, 116, 139, 0.1)', | ||
}} | ||
> | ||
<Header> | ||
<Image alt={name} src={image_url} width={30} height={30} /> | ||
<Typography variant="h6" color={BISCAY}> | ||
{name} | ||
</Typography> | ||
<Close onClick={closeModal} htmlColor={SALTBOX_BLUE} fontSize="medium" /> | ||
</Header> | ||
<Divider /> | ||
<Content> | ||
{secret_keys && | ||
secret_keys.map(({ label, name }) => ( | ||
<ControlledPassword | ||
key={label} | ||
control={control} | ||
name={name} | ||
label={label} | ||
rules={{ | ||
required: true, | ||
}} | ||
required | ||
/> | ||
))} | ||
</Content> | ||
<Divider /> | ||
<Footer> | ||
<Button variant="text" color="info" onClick={closeModal}> | ||
Cancel | ||
</Button> | ||
<Button variant="contained" color="primary" disabled={!isValid} onClick={handleSubmit}> | ||
Add | ||
</Button> | ||
</Footer> | ||
</Box> | ||
</Modal> | ||
); | ||
}; | ||
|
||
export default MarketplaceModal; |
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,32 @@ | ||
import styled from 'styled-components'; | ||
import CloseIcon from '@mui/icons-material/Close'; | ||
|
||
export const Content = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
gap: 24px; | ||
padding: 32px 24px; | ||
`; | ||
|
||
export const Close = styled(CloseIcon)` | ||
cursor: pointer; | ||
position: fixed; | ||
top: 25px; | ||
right: 25px; | ||
`; | ||
|
||
export const Footer = styled.div` | ||
display: flex; | ||
gap: 16px; | ||
justify-content: flex-end; | ||
padding: 16px 24px; | ||
width: calc(100% - 48px); | ||
`; | ||
|
||
export const Header = styled.div` | ||
display: flex; | ||
gap: 16px; | ||
padding: 24px; | ||
position: relative; | ||
text-transform: capitalize; | ||
`; |
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
Oops, something went wrong.