1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-30 08:09:15 +01:00
metamask-extension/ui/pages/add-collectible/add-collectible.component.js
ryanml 5712539a38
Implement 'Add NFT' screen (#12544)
* Implement 'Add NFT' screen

* Guarding added route with feature flag
2021-11-15 10:28:35 -07:00

66 lines
1.8 KiB
JavaScript

import React, { useState } from 'react';
import { useHistory } from 'react-router-dom';
import { useI18nContext } from '../../hooks/useI18nContext';
import { DEFAULT_ROUTE } from '../../helpers/constants/routes';
import Box from '../../components/ui/box';
import TextField from '../../components/ui/text-field';
import PageContainer from '../../components/ui/page-container';
export default function AddCollectible() {
const t = useI18nContext();
const history = useHistory();
const [address, setAddress] = useState('');
const [tokenId, setTokenId] = useState('');
return (
<PageContainer
title={t('addNFT')}
onSubmit={() => {
console.log(
`Adding collectible with ID: ${tokenId} and address ${address}`,
);
history.push(DEFAULT_ROUTE);
}}
submitText={t('add')}
onCancel={() => {
history.push(DEFAULT_ROUTE);
}}
onClose={() => {
history.push(DEFAULT_ROUTE);
}}
disabled={false}
contentComponent={
<Box padding={4}>
<Box>
<TextField
id="address"
label={t('address')}
placeholder="0x..."
type="text"
value={address}
onChange={(e) => setAddress(e.target.value)}
fullWidth
autoFocus
margin="normal"
/>
</Box>
<Box>
<TextField
id="token-id"
label={t('id')}
placeholder={t('nftTokenIdPlaceholder')}
type="number"
value={tokenId}
onChange={(e) => setTokenId(e.target.value)}
fullWidth
margin="normal"
/>
</Box>
</Box>
}
/>
);
}