-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rayan #21
Rayan #21
Changes from all commits
a298d14
9ccd466
c10b4f5
f7a0d7d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
npx lint-staged | ||
# npx lint-staged |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,41 @@ | ||
import { useRef, useEffect } from 'react' | ||
import { useRef, useEffect } from 'react'; | ||
import styles from './rail.module.css'; | ||
import PropTypes from 'prop-types'; | ||
|
||
const Rail = (props) => { | ||
const railRef = useRef(null); | ||
const scrollSpeed = typeof props.scrollSpeed === 'number' ? props.scrollSpeed : 1; | ||
const scrollSpeed = | ||
typeof props.scrollSpeed === 'number' ? props.scrollSpeed : 1; | ||
|
||
useEffect(() => { | ||
const el = railRef.current; | ||
const onWheel = e => { | ||
const onWheel = (e) => { | ||
if (e.deltaY == 0) return; | ||
e.preventDefault(); | ||
el.scrollTo({ | ||
left: el.scrollLeft + (e.deltaY * scrollSpeed), | ||
behavior: "smooth" // "smooth" or "auto" | ||
left: el.scrollLeft + e.deltaY * scrollSpeed, | ||
behavior: 'smooth', // "smooth" or "auto" | ||
}); | ||
}; | ||
if (el) { | ||
el.addEventListener("wheel", onWheel); | ||
el.addEventListener('wheel', onWheel); | ||
} | ||
return () => el && el.removeEventListener("wheel", onWheel); | ||
return () => el && el.removeEventListener('wheel', onWheel); | ||
}, []); | ||
|
||
return (<main className={[props.className, styles.railContainer].join(' ')} ref={railRef}> | ||
{props.children} | ||
</main>); | ||
} | ||
export default Rail; | ||
return ( | ||
<main | ||
className={[props.className, styles.railContainer].join(' ')} | ||
ref={railRef}> | ||
{props.children} | ||
</main> | ||
); | ||
}; | ||
|
||
Rail.propTypes = { | ||
scrollSpeed: PropTypes.number, | ||
className: PropTypes.string, | ||
children: PropTypes.any, | ||
}; | ||
|
||
export default Rail; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,17 @@ | ||
import SearchBar from './SearchBar'; | ||
import SearchBarLong from './SearchBarLong'; | ||
|
||
import PropTypes from 'prop-types'; | ||
|
||
SearchBar.propTypes = { | ||
type: PropTypes.oneOf(['long']), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here also prop There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. how do i do that |
||
long: PropTypes.bool, | ||
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), | ||
onChange: PropTypes.func, | ||
onKeyDown: PropTypes.func, | ||
onSearch: PropTypes.func, | ||
}; | ||
|
||
export default function Search(props) { | ||
function handleOnKeyDown(e) { | ||
if (e.key === 'Enter') { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,14 @@ import styles from './SmallCard.module.css'; | |
// import svgLogo from "assets/icons/icon.svg" | ||
import pngLogo from 'assets/icons/nexusblue.png'; | ||
import Image from 'next/dist/client/image'; | ||
import PropTypes from 'prop-types'; | ||
|
||
SmallCard.propTypes = { | ||
label: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired, | ||
sublabel: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sublabel is optional prop |
||
text: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired, | ||
ticker: PropTypes.any, | ||
}; | ||
|
||
export default function SmallCard(props) { | ||
return ( | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,53 @@ | ||
function blocks() { | ||
return <div>All blocks page</div>; | ||
import { Table } from 'antd'; | ||
|
||
export default function Blocks(props) { | ||
const { data } = props; | ||
|
||
const columns = [ | ||
{ | ||
title: 'Block', | ||
dataIndex: 'height', | ||
key: 'height', | ||
}, | ||
{ | ||
title: 'Date', | ||
dataIndex: 'date', | ||
key: 'date', | ||
// render: (val) => new Date(val).toDateString, | ||
}, | ||
{ | ||
title: 'Mint', | ||
dataIndex: 'mint', | ||
key: 'mint', | ||
}, | ||
{ | ||
title: 'TXNs', | ||
dataIndex: 'tx', | ||
render: (tx) => tx.length, | ||
}, | ||
{ | ||
title: 'Channel', | ||
dataIndex: 'channel', | ||
key: 'channel', | ||
}, | ||
]; | ||
|
||
return ( | ||
<div> | ||
<Table columns={columns} dataSource={data} /> | ||
</div> | ||
); | ||
} | ||
|
||
export default blocks; | ||
export async function getServerSideProps() { | ||
const resp = await fetch( | ||
`${process.env.NEXT_PUBLIC_NEXUS_BASE_URL}/ledger/list/blocks?limit=50` | ||
); | ||
const data = await resp.json(); | ||
|
||
return { | ||
props: { | ||
data: data.result, | ||
}, | ||
}; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,32 @@ | ||
import React from 'react'; | ||
// import Table from 'components/atoms/Table'; | ||
import { Table, Tag, Space } from 'antd'; | ||
import data from 'assets/data/richlist.json'; | ||
|
||
function richlist() { | ||
return <h1>richlist tab</h1>; | ||
const columns = [ | ||
{ | ||
title: 'Address', | ||
dataIndex: 'address', | ||
key: 'address', | ||
}, | ||
{ | ||
title: 'Balance', | ||
dataIndex: 'balance', | ||
key: 'balance', | ||
}, | ||
]; | ||
const newData = data.map((item, index) => ({ | ||
key: index, | ||
address: item[0], | ||
balance: `${parseInt(item[1]).toFixed(2)} NXS`, | ||
})); | ||
|
||
return ( | ||
<div style={{ overflow: 'scroll' }}> | ||
{/* <pre className="themeText">{JSON.stringify(data.result, null, 2)}</pre> */} | ||
<Table columns={columns} dataSource={newData} /> | ||
</div> | ||
); | ||
} | ||
|
||
export default richlist; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Scroll speed is optional
Don't give proptype as strictly required prop
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes i havent made it .isRequired