Skip to content

Commit a4ba07c

Browse files
Creates components
1 parent 4be7541 commit a4ba07c

File tree

11 files changed

+188
-125
lines changed

11 files changed

+188
-125
lines changed

react-app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "bitcoin-hash",
3-
"version": "1.0.3",
3+
"version": "1.0.4",
44
"dependencies": {
55
"@emotion/react": "^11.11.0",
66
"@emotion/styled": "^11.11.0",

react-app/src/BitcoinHash/BitcoinHash.tsx

Lines changed: 12 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,15 @@ import {
1616
Font,
1717
MuiTheme,
1818
WrapRedux,
19-
LeftColLinks,
19+
Addresses,
20+
Transactions,
2021
} from "./"
2122
console.log(pJSON.name, pJSON.version)
2223

2324
export default function BitcoinHash() {
2425
const output: any = null
2526
const title: string = "Bitcoin Hash"
26-
const description: string = "Retrieve and display address and transaction information from the BTC blockchain"
27-
const body: string|null = null
2827
const avatar: string = "/svg/logo.svg"
29-
const image: string|null = null // "/jpg/opengraph.jpg"
3028

3129
return (<>
3230
<WrapRedux>
@@ -41,54 +39,32 @@ export default function BitcoinHash() {
4139
e.preventDefault()
4240
window.open(`/`, "_self")
4341
}}>
44-
<Avatar src={avatar} alt={description}/>
42+
<Avatar src={avatar} alt={title}/>
4543
</IconButton></Tooltip>}
4644
title={<Font variant="description">
4745
{title}
48-
</Font>}
49-
subheader={<Font>
50-
{description}
51-
</Font>}
46+
</Font>}
5247
/>
5348
<Grid container>
5449

55-
<Grid item xs={12} sm={4}>
50+
<Grid item xs={12} sm={6}>
5651
<Box sx={{}}>
57-
<LeftColLinks />
52+
<Addresses />
5853
</Box>
5954
</Grid>
6055

61-
62-
<Grid item xs={12} sm={8}>
63-
64-
{output ? <pre>{JSON.stringify(output, null, 2)}</pre> : null}
65-
66-
<Grid container>
67-
{image ? <Grid item xs={12}>
68-
<CardMedia
69-
component={"img"}
70-
src={image}
71-
height={175}
72-
alt={`${title} ${description}`}
73-
/>
74-
</Grid> : null }
75-
{body ? <>
76-
<Grid item xs={12}>
77-
<CardContent>
78-
<Font>
79-
{body}
80-
</Font>
81-
</CardContent>
82-
</Grid>
83-
</> : null }
84-
</Grid>
56+
<Grid item xs={12} sm={6}>
57+
<Box sx={{}}>
58+
<Transactions />
59+
</Box>
8560
</Grid>
86-
61+
8762
</Grid>
8863
</Box>
8964
</Grid>
9065
</Grid>
9166
</Container>
67+
{output ? <pre>{JSON.stringify(output, null, 2)}</pre> : null}
9268
</MuiTheme>
9369
</WrapRedux>
9470
</>)
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import React from "react"
2+
import {
3+
Box,
4+
// Card,
5+
CardContent,
6+
} from "@mui/material"
7+
import {
8+
usePwaSelect,
9+
selectPWA,
10+
Font,
11+
} from ".."
12+
13+
export default function Address() {
14+
const pwa = usePwaSelect(selectPWA)
15+
return (<>
16+
<Box>
17+
<CardContent>
18+
<Font variant="description">
19+
Single Address
20+
</Font>
21+
</CardContent>
22+
</Box>
23+
</>)
24+
}
25+
26+
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import React from "react"
2+
import {
3+
Box,
4+
// Card,
5+
// CardContent,
6+
// CardHeader,
7+
} from "@mui/material"
8+
import {
9+
usePwaSelect,
10+
selectPWA,
11+
// Font,
12+
// Address,
13+
Search,
14+
} from ".."
15+
16+
export default function Addresses() {
17+
const pwa = usePwaSelect(selectPWA)
18+
return (<>
19+
<Box>
20+
<Search
21+
type="addresses"
22+
/>
23+
</Box>
24+
</>)
25+
}

react-app/src/BitcoinHash/components/LeftColLinks.tsx

Lines changed: 0 additions & 18 deletions
This file was deleted.
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
import * as React from 'react';
2+
import { styled, alpha } from '@mui/material/styles';
3+
import InputBase from '@mui/material/InputBase';
4+
import {SearchShape} from '../types';
5+
6+
import {
7+
Icon,
8+
} from "../"
9+
10+
const SearchBox = styled('div')(({ theme }) => ({
11+
position: 'relative',
12+
borderRadius: theme.shape.borderRadius,
13+
backgroundColor: alpha(theme.palette.primary.main, 0.15),
14+
'&:hover': {
15+
backgroundColor: alpha(theme.palette.primary.main, 0.25),
16+
},
17+
marginRight: theme.spacing(2),
18+
marginLeft: 0,
19+
width: '100%',
20+
[theme.breakpoints.up('sm')]: {
21+
marginLeft: theme.spacing(3),
22+
width: 'auto',
23+
},
24+
}));
25+
26+
const SearchIconWrapper = styled('div')(({ theme }) => ({
27+
padding: theme.spacing(0, 2),
28+
height: '100%',
29+
position: 'absolute',
30+
pointerEvents: 'none',
31+
display: 'flex',
32+
alignItems: 'center',
33+
justifyContent: 'center',
34+
}));
35+
36+
const StyledInputBase = styled(InputBase)(({ theme }) => ({
37+
color: 'inherit',
38+
'& .MuiInputBase-input': {
39+
padding: theme.spacing(1, 1, 1, 0),
40+
// vertical padding + font size from searchIcon
41+
paddingLeft: `calc(1em + ${theme.spacing(4)})`,
42+
transition: theme.transitions.create('width'),
43+
width: '100%',
44+
[theme.breakpoints.up('md')]: {
45+
width: '20ch',
46+
},
47+
},
48+
}));
49+
50+
export default function Search(props: SearchShape) {
51+
const {
52+
type,
53+
} = props
54+
55+
return (<>
56+
<SearchBox>
57+
<SearchIconWrapper>
58+
<Icon icon="search" color="primary" />
59+
</SearchIconWrapper>
60+
<StyledInputBase
61+
placeholder={`Search ${type}…`}
62+
inputProps={{ 'aria-label': 'search' }}
63+
/>
64+
</SearchBox>
65+
</>
66+
);
67+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import React from "react"
2+
import {
3+
Card,
4+
CardContent,
5+
} from "@mui/material"
6+
import {
7+
usePwaSelect,
8+
selectPWA,
9+
Font,
10+
} from ".."
11+
12+
export default function Transaction() {
13+
const pwa = usePwaSelect(selectPWA)
14+
return (<>
15+
<Card>
16+
<CardContent>
17+
<Font variant="description">
18+
Single Transaction
19+
</Font>
20+
</CardContent>
21+
</Card>
22+
</>)
23+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import React from "react"
2+
import {
3+
Box,
4+
} from "@mui/material"
5+
import {
6+
usePwaSelect,
7+
selectPWA,
8+
Search,
9+
} from "../"
10+
11+
export default function Transactions() {
12+
const pwa = usePwaSelect(selectPWA)
13+
return (<>
14+
<Box>
15+
<Search
16+
type="transactions"
17+
/>
18+
</Box>
19+
</>)
20+
}

react-app/src/BitcoinHash/index.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ import {makeTheme} from "./theme/makeTheme"
55
import MuiTheme from "./theme/MuiTheme"
66
import Icon from "./components/Icon"
77
import {Font} from "./components/Font"
8-
import LeftColLinks from "./components/LeftColLinks"
8+
import Addresses from "./components/Addresses"
9+
import Transactions from "./components/Transactions"
10+
import Search from "./components/Search"
11+
import Address from "./components/Address"
12+
import Transaction from "./components/Transaction"
913
import WrapRedux from "./redux/WrapRedux"
1014
import {theme} from "./redux/theme"
1115
import {selectPWA, setPwaKey} from "./redux/pwaReducer"
@@ -27,9 +31,13 @@ export {
2731
usePwaDispatch,
2832
usePwaSelect,
2933
makeTheme,
34+
Search,
35+
Transaction,
36+
Address,
37+
Transactions,
38+
Addresses,
3039
Icon,
3140
Font,
32-
LeftColLinks,
3341
selectPWA,
3442
startApp,
3543
setLocale,

react-app/src/BitcoinHash/redux/pwaReducer.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ import {
1010

1111
const initialState: PwaReduxShape = {
1212
started: false,
13-
sitemap: true,
14-
locale: "en",
13+
currency: "EUR",
1514
theme,
1615
}
1716

0 commit comments

Comments
 (0)