@chakra-ui/react#UnorderedList JavaScript Examples
The following examples show how to use
@chakra-ui/react#UnorderedList.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: components.js From idena-web with MIT License | 6 votes |
function IdenaBotFeatureList({features, listSeparator = ';'}) {
return (
<UnorderedList spacing={1} styleType="'- '" pl="2.5">
{features.map((feature, idx) => (
<ListItem key={feature} textTransform="lowercase">
{feature}
{idx < features.length - 1 ? listSeparator : '.'}
</ListItem>
))}
</UnorderedList>
)
}
Example #2
Source File: chakraMarkdownTheme.jsx From scaffold-directory with MIT License | 6 votes |
chakraMarkdownComponents = { a: ({ href, children }) => ( <Link href={href} color="blue.500"> {children} </Link> ), blockquote: props => <MdBlockQuote {...props} />, code: props => <MdCode {...props} />, h1: props => <MdH1 {...props} />, h2: ({ children }) => ( <Heading as="h2" size="lg" mt={6} mb={4}> {children} </Heading> ), h3: ({ children }) => ( <Heading as="h3" size="md" mt={6} mb={4}> {children} </Heading> ), hr: () => <Divider my={6} borderBottomWidth="4px" />, img: props => <Image {...props} mb={4} />, pre: props => <MdPre {...props} />, p: props => <MdP {...props} />, ul: ({ children }) => <UnorderedList mb={4}>{children}</UnorderedList>, }
Example #3
Source File: ExportForm.js From web-client with Apache License 2.0 | 5 votes |
ExportForm = () => {
const [entities] = useFetch('/system/exportables');
const [exportButtonDisabled, setExportButtonDisabled] = useState(true);
const [entitiesToExport, setEntitiesToExport] = useState([]);
const onEntitiesSelectionChange = ev => {
const selectedEntities = Array.from(ev.target.selectedOptions, option => option.value);
setExportButtonDisabled(selectedEntities.length === 0);
setEntitiesToExport(selectedEntities);
};
const onExportButtonClick = ev => {
ev.preventDefault();
const url = `/system/data?` + new URLSearchParams({ entities: entitiesToExport }).toString();
secureApiFetch(url, { method: 'GET' })
.then(resp => {
const contentDispositionHeader = resp.headers.get('Content-Disposition');
const filenameRe = new RegExp(/filename="(.*)";/)
const filename = filenameRe.exec(contentDispositionHeader)[1]
return Promise.all([resp.blob(), filename]);
})
.then((values) => {
const blob = values[0];
const filename = values[1];
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = filename;
a.click();
})
};
return <div>
<h3>Export system data</h3>
<div style={{ marginTop: '5px', marginBottom: '5px' }}>
Notes:
<UnorderedList>
<ListItem>Select one or more entities to export.</ListItem>
<ListItem>The data will be returned in JSON format.</ListItem>
<ListItem>This operation can take up to one minute to complete depending on the size of your database.</ListItem>
</UnorderedList>
</div>
<Select multiple style={{ width: '80%', height: 250 }} onChange={onEntitiesSelectionChange}>
{entities && entities.map(entity => <option key={entity.key} value={entity.key}>{entity.description}</option>)}
</Select>
<br />
<PrimaryButton disabled={exportButtonDisabled}
onClick={onExportButtonClick} leftIcon={<IconDownload />}>Export</PrimaryButton>
</div>
}
Example #4
Source File: ImportForm.js From web-client with Apache License 2.0 | 5 votes |
ImportForm = () => {
const [importResponse, setImportResponse] = useState(null);
const [importButtonDisabled, setImportButtonDisabled] = useState(true);
const handleUploadClick = ev => {
ev.preventDefault();
const resultFileInput = document.getElementById('importFile');
const formData = new FormData();
formData.append('importFile', resultFileInput.files[0]);
secureApiFetch('/system/data', {
method: 'POST',
body: formData
})
.then(resp => resp.json())
.then(resp => {
setImportResponse(resp);
})
.catch(err => console.error(err));
}
const onImportFileChange = ev => {
ev.preventDefault();
const selectedFiles = ev.target.files;
setImportButtonDisabled(selectedFiles.length === 0);
}
return <div>
<h3>Import system data</h3>
<form>
<div>
Notes:
<UnorderedList>
<ListItem>Everything on the file will be attempted to be imported.</ListItem>
<ListItem>If there is an error the import process will continue resulting on a partial import.</ListItem>
<ListItem>If there are missing attributes, Reconmap will attempt to use defaults instead.</ListItem>
<ListItem>Example of the files to import can be found on the following url: <ExternalLink href="https://github.com/reconmap/reconmap/tree/master/imports">https://github.com/reconmap/reconmap/tree/master/imports</ExternalLink> </ListItem>
</UnorderedList>
</div>
<FormControl id="importFile" isRequired>
<FormLabel>Import file</FormLabel>
<Input type="file" onChange={onImportFileChange} accept=".json,.js,application/json,text/json" isRequired />
</FormControl>
<PrimaryButton disabled={importButtonDisabled}
onClick={handleUploadClick} leftIcon={<IconUpload />}>Import</PrimaryButton>
</form>
{importResponse &&
<div>
<h4>Import completed</h4>
{importResponse.errors.length > 0 && <ul>
{importResponse.errors.map(error => <li style={{ color: 'orange' }}>
{error}
</li>)}
</ul>}
{importResponse.results.length > 0 && <>
<p>The number of imports per category are:</p>
<ul>
{importResponse.results.map(entityResult => {
return <li>{entityResult.count} {entityResult.name} ({entityResult.errors.length} errors)</li>
})}
</ul>
</>}
</div>
}
</div>
}
Example #5
Source File: BecomeMember.js From DAOInsure with MIT License | 4 votes |
function BecomeMember() {
const { signerAddress, provider, signer } = useContext(Web3Context);
const { isOpen, onOpen, onClose } = useDisclosure();
const [latitude, setLatitude] = useState();
const [longitude, setLongitude] = useState();
const handleChange = (e, setter) => {
setter(e.target.value);
};
const web3 = new Web3(provider);
console.log(web3);
const joinDao = async () => {
let contract = new ethers.Contract(
SUPERAPP_CONTRACT_ADDRESS,
SUPERAPP_CONTRACT_ABI,
signer
);
const walletAddress = await window.ethereum.request({
method: "eth_requestAccounts",
params: [
{
eth_accounts: {},
},
],
});
// this sdk has a lot of changes (breaking changes) from the version we used.
const sf = new SuperfluidSDK.Framework({
ethers: provider,
});
await sf.initialize();
// creating user from unlocked address. token is super token.
const carol = sf.user({
address: walletAddress[0],
token: "0x5D8B4C2554aeB7e86F387B4d6c00Ac33499Ed01f",
});
// creating a flow, user data can contain arbitary data.
await carol.flow({
recipient: SUPERAPP_CONTRACT_ADDRESS,
flowRate: "3858024691358",
userData: web3.eth.abi.encodeParameters(
["string", "string"],
[latitude, longitude]
),
});
// details of the user like incoming and outgoing flow rates, and the various active flows along with types.
const details = await carol.details();
console.log(details);
// // Call the host with the batch call parameters
// await sf.host.batchCall(createPlayBatchCall(100));
function createPlayBatchCall(upgradeAmount = 0) {
return [
[
202, // upgrade 100 daix to play the game
"0x5D8B4C2554aeB7e86F387B4d6c00Ac33499Ed01f",
// adding latitude and longitude to the encoded data.
contract.interface.encodeFunctionData("setCoordinates", [
parseInt(latitude),
parseInt(longitude),
]),
],
[
1, // approve the ticket fee
{
token: "0x5D8B4C2554aeB7e86F387B4d6c00Ac33499Ed01f", // Super Tokens only
amount: "1000000000000000000",
spender: SUPERAPP_CONTRACT_ADDRESS,
},
],
];
}
// Call the host with the batch call parameters
await sf.host.batchCall(createPlayBatchCall(100));
};
return (
<VStack spacing={5} mt='20px'>
<Modal
isOpen={isOpen}
onClose={onClose}
closeOnOverlayClick={false}>
<ModalOverlay />
<ModalContent>
<ModalHeader>Enter the following Details</ModalHeader>
<ModalCloseButton />
<ModalBody>
<HStack>
<Input
onChange={(e) => handleChange(e, setLatitude)}
placeholder='Latitude'
/>
<Input
onChange={(e) => handleChange(e, setLongitude)}
placeholder='Longitude'
/>
</HStack>
</ModalBody>
<ModalFooter>
<Button onClick={joinDao} colorScheme='whatsapp'>
Join DAO (10 DAIx / Month)
</Button>
</ModalFooter>
</ModalContent>
</Modal>
<Heading fontSize='32px'>Become A Member</Heading>
<Heading fontSize='24px'>How it works?</Heading>
<UnorderedList>
<ListItem>
DAOInsure provides insurances to its members based on DAO
voting
</ListItem>
<ListItem>
DAO members stream insurance premium to the treasury.
</ListItem>
<ListItem>
In exchange for premium paid the members get voting power.
</ListItem>
<ListItem>
Use voting power to approve other fellow member's claim.
</ListItem>
</UnorderedList>
<Heading fontSize='24px'>
Become A Member just 10 DAIx / Month
</Heading>
{signerAddress ? (
<Button colorScheme='whatsapp' onClick={onOpen}>
Join the DAO
</Button>
) : (
<GreenTag>Please connect wallet first</GreenTag>
)}
</VStack>
);
}
Example #6
Source File: affiliate.js From idena-web with MIT License | 4 votes |
export default function Affiliate() {
const {t} = useTranslation()
const {coinbase} = useAuthState()
const refLink = `app.idena.io?ref=${coinbase}`
const {onCopy: onCopyRef, hasCopied} = useClipboard(refLink)
const detailLinkTitle = useBreakpointValue([
'More details',
'More details about Idena affiliate program',
])
return (
<SettingsLayout title={t('Affilate program')}>
<Flex direction="column" mt={10} w={['100%', '480px']}>
<SubHeading fontSize={['20px', 'lg']} mb={4}>
{t('Idena affiliate program')}
</SubHeading>
<Text fontSize={['mdx', 'md']}>
{t(
'The program allows you to earn rewards for new validated identities you bring to the network.'
)}
</Text>
<FullSizeLink
label={detailLinkTitle}
href="https://docs.idena.io/docs/community/affiliate"
mt={[4, '3px']}
>
<Box boxSize={8} backgroundColor="brandBlue.10" borderRadius="10px">
<OpenExplorerIcon boxSize={5} mt="6px" ml="6px" />
</Box>
</FullSizeLink>
<UnorderedList mt={9} ml={[0, 4]}>
<UniversalListItem title="Apply for participation by submitting request form">
<SimpleLink href="https://forms.gle/1R1AKZokEYn3aUU19">
{t('Referral link request form')}
</SimpleLink>
</UniversalListItem>
<UniversalListItem title="Spread the word">
<Text>{t('Educate your community about Idena')}</Text>
</UniversalListItem>
<UniversalListItem title="Share your referral link">
<Box mt={2} mb={4} display={['block', 'none']}>
{hasCopied ? (
<FormLabel
position="absolute"
right={0}
top="1px"
fontSize="base"
color="green.500"
h={5}
m={0}
>
{t('Copied!')}
</FormLabel>
) : (
<FlatButton
position="absolute"
right={0}
top="2px"
fontSize="base"
fontWeight={500}
h={5}
onClick={onCopyRef}
>
{t('Copy')}
</FlatButton>
)}
<Input
size="lg"
textOverflow="ellipsis"
overflow="hidden"
whiteSpace="nowrap"
value={refLink}
width="100%"
disabled
/>
</Box>
<Text>
{t(
'Motivate your audience to join and help them to get an invite'
)}
</Text>
<Box
display={['none', 'block']}
mt={4}
px={10}
py={6}
backgroundColor="gray.50"
borderRadius="lg"
>
<Flex justify="space-between">
<Text color="muted">{t('Your Referral link')}</Text>
{hasCopied ? (
<FormLabel color="green.500" fontSize="md" m={0}>
{t('Copied!')}
</FormLabel>
) : (
<FlatButton fontWeight={500} onClick={onCopyRef}>
{t('Copy')}
</FlatButton>
)}
</Flex>
<Text
color="gray.500"
fontWeight={500}
wordBreak="break-all"
w="80%"
>
{refLink}
</Text>
</Box>
</UniversalListItem>
<UniversalListItem title="Help your invitees through the onboarding process">
<Text>
{t(
'Remind them about the validation ceremony and help them get validated'
)}
</Text>
</UniversalListItem>
<UniversalListItem isLast title="Get rewards">
<Trans t={t} i18nKey="affiliateFillRewards">
<Text>
Find the rewards you get and reward conditions on the{' '}
<SimpleLink href="https://docs.idena.io/docs/community/affiliate">
Idena affiliate program page
</SimpleLink>
</Text>
</Trans>
</UniversalListItem>
</UnorderedList>
</Flex>
</SettingsLayout>
)
}
Example #7
Source File: ChallengeReviewRow.jsx From scaffold-directory with MIT License | 4 votes |
export default function ChallengeReviewRow({ challenge, isLoading, approveClick, rejectClick, userProvider }) {
const [comment, setComment] = useState(challenge.reviewComment ?? "");
const [testPassed, setTestPassed] = useState(null);
const [isRunningTests, setIsRunningTests] = useState(false);
const { isOpen, onOpen, onClose } = useDisclosure();
const address = useUserAddress(userProvider);
if (!challengeInfo[challenge.id]) {
return null;
}
// We asume that rejected challenges will always have review Comments.
const isAutograded = challenge.autograding;
// ToDo. Use the stored events.
const isResubmitted = !isAutograded && !!challenge.reviewComment;
const runTests = async () => {
try {
console.log("Testing challenge with the auto-grader");
setIsRunningTests(true);
setTestPassed(null);
const result = await runAutograderTest(challenge.id, challenge.contractUrl, address);
const resultData = result.data;
console.log("Testing results", resultData);
setTestPassed(resultData.success);
setComment(resultData.feedback ?? resultData.error);
} catch (e) {
console.log("Error calling the auto-grader", e);
} finally {
setIsRunningTests(false);
}
};
const challengeReviewDisplay = (
<Link as={RouteLink} to={`/challenge/${challenge.id}`}>
{challengeInfo[challenge.id].label}
{isResubmitted && (
<>
<br />
<Text fontSize="xs">(Resubmitted)</Text>
</>
)}
{isAutograded && (
<>
<br />
<Text fontSize="xs" color="orange.500">
(Autograded)
</Text>
</>
)}
</Link>
);
const submittedMoment = moment(challenge.submittedTimestamp);
const reviewRow = (
<>
<Td>
<Link as={RouteLink} to={`/builders/${challenge.userAddress}`} pos="relative">
<Address address={challenge.userAddress} w="12.5" fontSize="16" />
</Link>
</Td>
<Td>{challengeReviewDisplay}</Td>
<Td>
<DateWithTooltip timestamp={challenge.submittedTimestamp} />
</Td>
</>
);
return (
<Tr>
{reviewRow}
<Td>
<Button type="button" colorScheme="blue" disabled={isLoading} className="danger" onClick={onOpen} size="xs">
Review
</Button>
</Td>
<Modal isOpen={isOpen} onClose={onClose} size="xl">
<ModalOverlay />
<ModalContent maxW="56rem">
<ModalHeader>Review Challenge</ModalHeader>
<ModalCloseButton />
<Table mb={4}>
<Thead>
<Tr>
<Th>Builder</Th>
<Th>Challenge & Links</Th>
</Tr>
</Thead>
<Tbody>
<Tr>
<Td>
<Link as={RouteLink} to={`/builders/${challenge.userAddress}`} pos="relative">
<Address address={challenge.userAddress} w="12.5" fontSize="16" />
</Link>
</Td>
<Td>
{challengeReviewDisplay}
<UnorderedList>
<ListItem>
<Link
// Legacy branchUrl
href={challenge.contractUrl || challenge.branchUrl}
color="teal.500"
target="_blank"
rel="noopener noreferrer"
>
Contract
</Link>
</ListItem>
<ListItem>
<Link href={challenge.deployedUrl} color="teal.500" target="_blank" rel="noopener noreferrer">
Demo
</Link>
</ListItem>
<ListItem>
Submitted{" "}
<Tooltip label={submittedMoment.format("YYYY-MM-DD, HH:mm")}>
<chakra.span cursor="pointer">{submittedMoment.fromNow()}</chakra.span>
</Tooltip>
</ListItem>
<ListItem listStyleType="none" mt={2}>
<Flex align="center">
<Button onClick={runTests} isLoading={isRunningTests} mr={2}>
Run tests
</Button>
{isBoolean(testPassed) && (
<Badge colorScheme={testPassed ? "green" : "red"}>
{testPassed ? "Accepted" : "Rejected"}
</Badge>
)}
</Flex>
</ListItem>
</UnorderedList>
</Td>
</Tr>
</Tbody>
</Table>
<ModalBody px={6} pb={0}>
<Tabs variant="enclosed-colored">
<TabList>
<Tab>Write</Tab>
<Tab>Preview</Tab>
</TabList>
<TabPanels align="left">
<TabPanel p={0}>
<Textarea
onChange={e => {
const value = e.target.value;
setComment(value);
}}
placeholder="Comment"
style={{ marginBottom: 10 }}
rows={10}
value={comment}
borderTopRadius={0}
/>
</TabPanel>
<TabPanel>
<ReactMarkdown components={ChakraUIRenderer(chakraMarkdownComponents)}>{comment}</ReactMarkdown>
</TabPanel>
</TabPanels>
</Tabs>
</ModalBody>
<ModalFooter>
<Button
type="button"
colorScheme="red"
disabled={isLoading}
className="danger"
onClick={() => rejectClick(challenge.userAddress, challenge.id, comment)}
size="sm"
isFullWidth
>
Reject
</Button>
<Button
type="button"
colorScheme="green"
disabled={isLoading}
ml={3}
onClick={() => approveClick(challenge.userAddress, challenge.id, comment)}
size="sm"
isFullWidth
>
Approve
</Button>
</ModalFooter>
</ModalContent>
</Modal>
</Tr>
);
}