Created
March 4, 2020 12:06
-
-
Save jimmychu0807/a678f33d2c53e9df0f1f953d4328418a to your computer and use it in GitHub Desktop.
Markdium-用 Substrate Front-end Template 輕鬆打造你的 React 應用
This file contains hidden or 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
import { useSubstrate } from './substrate-lib'; | |
import { TxButton } from './substrate-lib/components'; | |
//... | |
function main (props) { | |
//... | |
return ( | |
<Grid.Column> | |
<h1>Template Module</h1> | |
<Card> | |
<Card.Content textAlign='center'> | |
<Statistic | |
label='Current Value' | |
value={currentValue} | |
/> | |
</Card.Content> | |
</Card> | |
<Form> | |
<Form.Field> | |
<Input | |
type='number' | |
id='new_value' | |
state='newValue' | |
label='New Value' | |
onChange={(_, { value }) => setFormValue(value)} | |
/> | |
</Form.Field> | |
<Form.Field> | |
<TxButton | |
accountPair={accountPair} | |
label='Store Something' | |
setStatus={setStatus} | |
type='TRANSACTION' | |
attrs={{ | |
params: [formValue], | |
tx: api.tx.templateModule.doSomething | |
}} | |
/> | |
</Form.Field> | |
<div style={{ overflowWrap: 'break-word' }}>{status}</div> | |
</Form> | |
</Grid.Column> | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment