Skip to content
This repository has been archived by the owner on Aug 9, 2022. It is now read-only.

Commit

Permalink
feat(storage): extracts offers checkout state
Browse files Browse the repository at this point in the history
to its own context

squash: splits context state
  • Loading branch information
jurajpiar committed Sep 24, 2020
1 parent e71ca75 commit ec754fd
Show file tree
Hide file tree
Showing 6 changed files with 524 additions and 222 deletions.
10 changes: 8 additions & 2 deletions src/components/molecules/storage/buy/LabelWithValue.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,18 @@ const LabelWithValue: FC<LabelWithValueProps> = ({
}) => (
<GridRow
spacing={2}
style={{
paddingBottom: '0px',
}}
{...props}
>
<GridItem>
<Typography
color="primary"
color="secondary"
align="center"
style={{
fontSize: fonts.size.subtitleSmall,
}}
{...labelProps}
>
{label}
Expand All @@ -36,7 +42,7 @@ const LabelWithValue: FC<LabelWithValueProps> = ({
color="secondary"
align="center"
style={{
fontSize: fonts.size.subtitleSmall,
fontSize: fonts.size.subtitleBig,
}}
{...valueProps}
>
Expand Down
90 changes: 90 additions & 0 deletions src/components/organisms/storage/buy/StorageOfferDescription.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
import { Box, Typography } from '@material-ui/core'
import { shortenString } from '@rsksmart/rif-ui'
import GridItem from 'components/atoms/GridItem'
import GridRow from 'components/atoms/GridRow'
import LabelWithValue from 'components/atoms/LabelWithValue'
import { Order, PinnedContent } from 'components/pages/storage/buy/CheckoutContext'
import React, { FC } from 'react'

type Props = Order & PinnedContent

const StorageOrderDescription: FC<{order: Props}> = ({ order }) => {
const {
name: contentName,
size: contentSize,
hash: contentHash,
id,
system,
} = order

return (
<GridItem>
<GridRow>
<GridItem>
<Typography
variant="subtitle1"
color="primary"
>
Selected storage provider
</Typography>
</GridItem>
<GridItem>
<LabelWithValue
label=""
value={shortenString(id)}
/>
</GridItem>
<GridItem>
<LabelWithValue
label="System"
value={system}
/>
</GridItem>
</GridRow>
{contentHash && contentSize && contentName
? (
<GridRow>
<GridItem>
<Typography
variant="subtitle1"
color="primary"
>
Uploaded content
</Typography>
</GridItem>
<GridItem>
<LabelWithValue
label="Name:"
value={contentName}
/>
</GridItem>
<GridItem>
<LabelWithValue
label="Hash:"
value={shortenString(contentHash)}
/>
</GridItem>
<GridItem>
<LabelWithValue
label="Size:"
value={contentSize}
/>
</GridItem>
</GridRow>
)
: (
<GridRow>
<GridItem>
<Typography color="textPrimary" component="div">
<Box display="inline" fontWeight="fontWeightMedium">
The size of your storage plan is calculated by the content that you upload/persist in this first step.
</Box>
</Typography>
</GridItem>
</GridRow>
)}
</GridItem>
)
}

export default StorageOrderDescription
Loading

0 comments on commit ec754fd

Please sign in to comment.