Skip to content

Instantly share code, notes, and snippets.

@jimmychu0807
Created March 4, 2020 12:06
Show Gist options
  • Save jimmychu0807/a678f33d2c53e9df0f1f953d4328418a to your computer and use it in GitHub Desktop.
Save jimmychu0807/a678f33d2c53e9df0f1f953d4328418a to your computer and use it in GitHub Desktop.
Markdium-用 Substrate Front-end Template 輕鬆打造你的 React 應用
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