@chakra-ui/react#UnorderedList TypeScript 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: ComponentMapping.tsx From coindrop with GNU General Public License v3.0 | 6 votes |
components = { h1: ({ children }) => <Heading as="h1" my="1.5rem" size="2xl">{children}</Heading>, h2: ({ children }) => <Heading as="h2" my="1.5rem" size="xl">{children}</Heading>, h3: ({ children }) => <Heading as="h3" my="1.5rem" size="lg">{children}</Heading>, h4: ({ children }) => <Heading as="h4" my="1.5rem" size="md">{children}</Heading>, p: ({ children }) => <Text mb="1.5rem" fontSize="lg">{children}</Text>, Center, ul: ({ children }) => <UnorderedList mb="1.5rem">{children}</UnorderedList>, ol: ({ children }) => <OrderedList mb="1.5rem">{children}</OrderedList>, li: ({ children }) => <ListItem fontSize="lg">{children}</ListItem>, Image, ImageBorder, code: Code, CodeBlock, a: ({ children, href }) => <u><Link href={href} isExternal>{children}</Link></u>, NextLink: ({ children, href }) => <u><NextLink href={href}>{children}</NextLink></u>, }
Example #2
Source File: CoindropRequirements.tsx From coindrop with GNU General Public License v3.0 | 6 votes |
CoindropRequirements: FC = () => (
<Box mt={2} textAlign="center">
<Text>
Coindrop URLs must:
</Text>
<UnorderedList listStylePosition="inside">
<ListItem>Start with a letter</ListItem>
<ListItem>Only include letters, numbers, dashes (-), and underscores (_)</ListItem>
<ListItem>End with a letter or number</ListItem>
<ListItem>Between 3 and 32 characters in length</ListItem>
</UnorderedList>
</Box>
)
Example #3
Source File: PermissionRequirements.tsx From bluebubbles-server with Apache License 2.0 | 5 votes |
PermissionRequirements = (): JSX.Element => {
const permissions: Array<RequirementsItem> = (useAppSelector(state => state.config.permissions) ?? []);
const [showProgress, setShowProgress] = useBoolean();
const refreshRequirements = () => {
setShowProgress.on();
checkPermissions().then(permissions => {
// I like longer spinning
setTimeout(() => {
setShowProgress.off();
}, 1000);
if (!permissions) return;
store.dispatch(setConfig({ name: 'permissions', value: permissions }));
});
};
return (
<Box border='1px solid' borderColor={useColorModeValue('gray.200', 'gray.700')} borderRadius='xl' p={3} width='325px'>
<Stack direction='row' align='center'>
<Text fontSize='lg' fontWeight='bold'>macOS Permissions</Text>
<Box
_hover={{ cursor: 'pointer' }}
animation={showProgress ? `${spin} infinite 1s linear` : undefined}
onClick={refreshRequirements}
>
<BiRefresh />
</Box>
</Stack>
<UnorderedList mt={2} ml={8}>
{permissions.map(e => (
<ListItem key={e.name}>
<Stack direction='row' align='center'>
<Text fontSize='md'><strong>{e.name}</strong>:
<Box as='span' color={e.pass ? 'green' : 'red'}>{e.pass ? 'Pass' : 'Fail'}</Box>
</Text>
{(e.pass) ? (
<Popover trigger='hover'>
<PopoverTrigger>
<Box ml={2} _hover={{ color: 'brand.primary', cursor: 'pointer' }}>
<AiOutlineInfoCircle />
</Box>
</PopoverTrigger>
<PopoverContent>
<PopoverArrow />
<PopoverCloseButton />
<PopoverHeader>How to Fix</PopoverHeader>
<PopoverBody>
<Text>
{e.solution}
</Text>
</PopoverBody>
</PopoverContent>
</Popover>
): null}
</Stack>
</ListItem>
))}
</UnorderedList>
</Box>
);
}
Example #4
Source File: PrivateApiRequirements.tsx From bluebubbles-server with Apache License 2.0 | 5 votes |
PrivateApiRequirements = (): JSX.Element => {
const requirements: Array<RequirementsItem> = (useAppSelector(state => state.config.private_api_requirements) ?? []);
const [showProgress, setShowProgress] = useBoolean();
const refreshRequirements = () => {
setShowProgress.on();
getPrivateApiRequirements().then(requirements => {
// I like longer spinning
setTimeout(() => {
setShowProgress.off();
}, 1000);
if (!requirements) return;
store.dispatch(setConfig({ name: 'private_api_requirements', value: requirements }));
});
};
return (
<Box border='1px solid' borderColor={useColorModeValue('gray.200', 'gray.700')} borderRadius='xl' p={3} width='325px'>
<Stack direction='row' align='center'>
<Text fontSize='lg' fontWeight='bold'>Private API Requirements</Text>
<Box
_hover={{ cursor: 'pointer' }}
animation={showProgress ? `${spin} infinite 1s linear` : undefined}
onClick={refreshRequirements}
>
<BiRefresh />
</Box>
</Stack>
<UnorderedList mt={2} ml={8}>
{requirements.map(e => (
<ListItem key={e.name}>
<Stack direction='row' align='center'>
<Text fontSize='md'><strong>{e.name}</strong>:
<Box as='span' color={e.pass ? 'green' : 'red'}>{e.pass ? 'Pass' : 'Fail'}</Box>
</Text>
{(!e.pass) ? (
<Popover trigger='hover'>
<PopoverTrigger>
<Box ml={2} _hover={{ color: 'brand.primary', cursor: 'pointer' }}>
<AiOutlineInfoCircle />
</Box>
</PopoverTrigger>
<PopoverContent>
<PopoverArrow />
<PopoverCloseButton />
<PopoverHeader>How to Fix</PopoverHeader>
<PopoverBody>
<Text>
{e.solution}
</Text>
</PopoverBody>
</PopoverContent>
</Popover>
): null}
</Stack>
</ListItem>
))}
</UnorderedList>
</Box>
);
}
Example #5
Source File: ErrorDialog.tsx From bluebubbles-server with Apache License 2.0 | 5 votes |
ErrorDialog = ({
title = 'Error!',
errorsPrefix = 'The following errors have occurred:',
errors,
closeButtonText = 'Close',
isOpen,
modalRef,
onClose
}: ErrorDialogProps): JSX.Element => {
return (
<AlertDialog
isOpen={isOpen}
leastDestructiveRef={modalRef}
onClose={() => onClose()}
>
<AlertDialogOverlay>
<AlertDialogContent>
<AlertDialogHeader fontSize='lg' fontWeight='bold'>
{title}
</AlertDialogHeader>
<AlertDialogBody>
{errorsPrefix}
<br />
<br />
<UnorderedList>
{errors.map(e => {
return <ListItem key={e.id}>{e.message}</ListItem>;
})}
</UnorderedList>
</AlertDialogBody>
<AlertDialogFooter>
<Button
ref={modalRef as React.LegacyRef<HTMLButtonElement> | undefined}
onClick={() => onClose()}
>
{closeButtonText}
</Button>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialogOverlay>
</AlertDialog>
);
}
Example #6
Source File: mdxComponents.tsx From lucide with ISC License | 5 votes |
components = {
h1: (props) => (
<HeadingAnchored as="h1" size="xl" mb={4} {...props}/>
),
h2: ({children, ...rest}) => (
<HeadingAnchored as="h2" size="lg" py={4} { ...rest}>
{children}
<Divider mt={4}/>
</HeadingAnchored>
),
h3: (props) => (
<HeadingAnchored as="h3" size="md" pt={4} mb={4} {...props}/>
),
h4: (props) => (
<HeadingAnchored as="h4" size="sm" pt={4} mb={4} {...props}/>
),
h5: (props) => (
<HeadingAnchored as="h5" size="xs" pt={2} mb={1} {...props}/>
),
h6: (props) => (
<HeadingAnchored as="h6" size="xs" pt={2} mb={1} opacity={.75} {...props}/>
),
ul: (props) => <UnorderedList my={2}>{props.children}</UnorderedList>,
ol: (props) => <OrderedList my={2}>{props.children}</OrderedList>,
li: (props) => <ListItem my={1}>{props.children}</ListItem>,
p: (props) => <Text my={4}>{props.children}</Text>,
img: ({ children, ...rest }) => <Image {...rest} borderRadius={4} my={2}>{children}</Image>,
code: ({ className, children: code }) => {
const language = className.replace('language-', '');
return (
<CodeBlock
//@ts-ignore
my={6}
code={code}
language={language}
/>
)
},
table: (props) => <Table {...props} rounded={4} mb={4}/>,
thead: Thead,
tbody: Tbody,
tr: Tr,
th: Th,
td: Td,
blockquote: (props) => (
<Alert
mt="4"
role="none"
status="warning"
variant="left-accent"
as="blockquote"
rounded={4}
my="1.5rem"
{...props}
/>
),
inlineCode: InlineCode,
hr: (props) => <Divider my={4}/>,
a: ({children, href, ...rest}) => {
let link = href
const isExternal = link.startsWith('http')
if(link.startsWith('packages/')) {
link = href.replace('packages/', '')
}
link = link.replace('.md', '')
return (
<NextLink
href={isExternal ? href : `/docs/${link}`}
{...rest}
passHref
>
<Link isExternal={isExternal} color='#F56565'>{children}</Link>
</NextLink>
)
}
}
Example #7
Source File: DynamicDnsDialog.tsx From bluebubbles-server with Apache License 2.0 | 4 votes |
DynamicDnsDialog = ({
onCancel,
onConfirm,
isOpen,
modalRef,
onClose,
port = 1234
}: DynamicDnsDialogProps): JSX.Element => {
const [address, setAddress] = useState('');
const [error, setError] = useState('');
const isInvalid = (error ?? '').length > 0;
return (
<AlertDialog
isOpen={isOpen}
leastDestructiveRef={modalRef}
onClose={() => onClose()}
>
<AlertDialogOverlay>
<AlertDialogContent>
<AlertDialogHeader fontSize='lg' fontWeight='bold'>
Set Dynamic DNS
</AlertDialogHeader>
<AlertDialogBody>
<Text>Enter your Dynamic DNS URL, including the schema and port. Here are some examples:</Text>
<br />
<UnorderedList>
<ListItem>http://thequickbrownfox.ddns.net:{port}</ListItem>
<ListItem>http://bluebubbles.no-ip.org:{port}</ListItem>
</UnorderedList>
<br />
<Text>If you plan to use your own custom certificate, please remember to use <strong>"https://"</strong> as your URL scheme</Text>
<br />
<FormControl isInvalid={isInvalid}>
<FormLabel htmlFor='address'>Dynamic DNS</FormLabel>
<Input
id='address'
type='text'
maxWidth="20em"
value={address}
placeholder={`http://<your DNS>:${port}`}
onChange={(e) => {
setError('');
setAddress(e.target.value);
}}
/>
{isInvalid ? (
<FormErrorMessage>{error}</FormErrorMessage>
) : null}
</FormControl>
</AlertDialogBody>
<AlertDialogFooter>
<Button
ref={modalRef as React.LegacyRef<HTMLButtonElement> | undefined}
onClick={() => {
if (onCancel) onCancel();
onClose();
}}
>
Cancel
</Button>
<Button
ml={3}
bg='brand.primary'
ref={modalRef as React.LegacyRef<HTMLButtonElement> | undefined}
onClick={() => {
if (address.length === 0) {
setError('Please enter a Dynamic DNS address!');
return;
}
if (onConfirm) onConfirm(address);
onClose();
}}
>
Save
</Button>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialogOverlay>
</AlertDialog>
);
}
Example #8
Source File: HomeLayout.tsx From bluebubbles-server with Apache License 2.0 | 4 votes |
HomeLayout = (): JSX.Element => {
const address = useAppSelector(state => state.config.server_address);
const fcmClient = useAppSelector(state => state.config.fcm_client);
const password = useAppSelector(state => state.config.password);
const port = useAppSelector(state => state.config.socket_port);
const qrCode = fcmClient ? buildQrData(password, address, fcmClient) : null;
return (
<Box p={3} borderRadius={10}>
<Flex flexDirection="column">
<Stack direction='column' p={5}>
<Flex flexDirection='row' justifyContent='flex-start' alignItems='center'>
<Text fontSize='2xl'>Connection Details</Text>
<Popover trigger='hover'>
<PopoverTrigger>
<Box ml={2} _hover={{ color: 'brand.primary', cursor: 'pointer' }}>
<AiOutlineInfoCircle />
</Box>
</PopoverTrigger>
<PopoverContent>
<PopoverArrow />
<PopoverCloseButton />
<PopoverHeader>Information</PopoverHeader>
<PopoverBody>
<Text>
This page will detail your current connection details. This includes your
server address and your local port.
</Text>
<br />
<UnorderedList>
<ListItem><strong>Server Address:</strong> This is the address that your clients will connect to</ListItem>
<ListItem><strong>Local Port:</strong> This is the port that the HTTP server is running on,
and the port you will use when port forwarding
for a dynamic DNS
</ListItem>
</UnorderedList>
</PopoverBody>
</PopoverContent>
</Popover>
</Flex>
<Divider orientation='horizontal' />
<Spacer />
<Flex flexDirection="row" justifyContent="space-between">
<Stack>
<Flex flexDirection="row" alignItems='center'>
<Text fontSize='md' fontWeight='bold' mr={2}>Server Address: </Text>
{(!address) ? (
<SkeletonText noOfLines={1} />
) : (
<Text fontSize='md'>{address}</Text>
)}
<Tooltip label='Copy Address'>
<IconButton
ml={3}
size='md'
aria-label='Copy Address'
icon={<BiCopy size='22px' />}
onClick={() => copyToClipboard(address)}
/>
</Tooltip>
<Popover placement='bottom' isLazy={true}>
<PopoverTrigger>
<Box ml={2} _hover={{ color: 'brand.primary', cursor: 'pointer' }} >
<Tooltip label='Show QR Code'>
<IconButton
ml={1}
size='md'
aria-label='Show QR Code'
icon={<AiOutlineQrcode size='24px' />}
/>
</Tooltip>
</Box>
</PopoverTrigger>
<PopoverContent>
<PopoverArrow />
<PopoverCloseButton />
<PopoverHeader>QR Code</PopoverHeader>
<PopoverBody>
<Flex justifyContent='center' flexDirection='column' alignItems='center'>
<Text>
Your QR Code contains your server configuration so that clients can connect.
Your QR Code should remain <strong>private</strong> as it contains sensitive information!
</Text>
<Box border="5px solid" borderColor='white' mt={4} height='266px' width='266px' borderRadius='lg' mb={3}>
{/* eslint-disable-next-line @typescript-eslint/ban-ts-comment */}
{/* @ts-ignore: ts2876 */}
{(qrCode) ? <QRCode value={qrCode as string} /> : null}
</Box>
</Flex>
</PopoverBody>
</PopoverContent>
</Popover>
</Flex>
<Flex flexDirection="row">
<Text fontSize='md' fontWeight='bold' mr={2}>Local Port: </Text>
{(!port) ? (
<SkeletonText noOfLines={1} />
) : (
<Text fontSize='md'>{port}</Text>
)}
</Flex>
</Stack>
<Divider orientation="vertical" />
</Flex>
</Stack>
<Stack direction='column' p={5}>
<Flex flexDirection='row' justifyContent='flex-start' alignItems='center'>
<Text fontSize='2xl'>iMessage Highlights</Text>
<Popover trigger='hover'>
<PopoverTrigger>
<Box ml={2} _hover={{ color: 'brand.primary', cursor: 'pointer' }}>
<AiOutlineInfoCircle />
</Box>
</PopoverTrigger>
<PopoverContent>
<PopoverArrow />
<PopoverCloseButton />
<PopoverHeader>Information</PopoverHeader>
<PopoverBody>
<Text>
These are just some fun stats that I included to give you a quick "snapshot"
of your iMessage history on the Mac Device. This does not include messages that
are on Apple's servers, only what is local to this device.
</Text>
</PopoverBody>
</PopoverContent>
</Popover>
</Flex>
<Divider orientation='horizontal' />
<Spacer />
{ /* Delays are so older systems do not freeze when requesting data from the databases */ }
<SimpleGrid columns={3} spacing={5}>
<TotalMessagesStatBox />
<TopGroupStatBox delay={200} />
<BestFriendStatBox delay={400} />
<DailyMessagesStatBox delay={600} />
<TotalPicturesStatBox delay={800} />
<TotalVideosStatBox delay={1000} />
</SimpleGrid>
</Stack>
</Flex>
</Box>
);
}
Example #9
Source File: notebook-post.tsx From portfolio with MIT License | 4 votes |
NotebookPost: React.SFC<PostProps> = () => {
const textColor = useColorModeValue("gray.500", "gray.200");
const post = articles[4];
return (
<>
<VStack mt={0} mb={6} spacing={1} align="start">
<Heading as="h1" fontSize="3xl" lineHeight="shorter" fontWeight="bold">
{post.title}
</Heading>
<Divider
orientation="horizontal"
opacity={1}
borderBottomWidth={0}
height={"1px"}
bg={"gray.200"}
/>
</VStack>
<Flex
justifyContent={"space-between"}
flexDirection={["column", "row", "row"]}
>
<HStack spacing={2} isInline>
<Text fontSize="sm" fontWeight="400" color={textColor}>
{post.published}
</Text>
<Text fontSize="sm" fontWeight="400" color={textColor}>
•
</Text>
<Tooltip hasArrow label="Views" placement="top">
<Flex alignItems="center">
<Text
fontSize="sm"
noOfLines={1}
fontWeight="400"
align="left"
color={textColor}
>
{post.views}
</Text>
<Icon as={FaEye} ml={1} color={textColor} />
</Flex>
</Tooltip>
<Text fontSize="sm" fontWeight="600" color={textColor}>
•
</Text>
<Tooltip hasArrow label="Read time" placement="top">
<Text
fontSize="sm"
noOfLines={1}
fontWeight="400"
align="left"
color={textColor}
>
{post.readTime}
</Text>
</Tooltip>
</HStack>
<HStack spacing={1} alignItems="center">
{post.tags.map(tag => (
<Tag
size="sm"
padding="0 3px"
key={tag}
colorScheme={getTagColor(tag)}
>
{tag}
</Tag>
))}
</HStack>
</Flex>
<HStack align="end" mt={5}>
<Link href={post.live} isExternal>
<Button
ml={2}
variant="outline"
size={["sm"]}
color={useColorModeValue("green.600", "green.200")}
bg={useColorModeValue("white", "gray.800")}
leftIcon={<BiLinkExternal size={18} />}
>
Demo
</Button>
</Link>
<Link href={post.github_url} isExternal>
<Button
ml={2}
variant="outline"
size={["sm"]}
color={useColorModeValue("green.600", "green.200")}
bg={useColorModeValue("white", "gray.800")}
leftIcon={<FiGithub size={18} />}
>
Github link
</Button>
</Link>
</HStack>
<Box height={["35vh", "45vh", "55vh", "70vh"]} marginTop={5}>
<Carousel images={post.images} />
</Box>
<VStack spacing={5} align={"start"} mt={6}>
<Header fontSize={"xl"} mt={0} mb={0}>
What will you learn?
</Header>
<Box fontSize="md">
<UnorderedList textAlign="left" paddingLeft={5} m={0}>
<ListItem>How to create a CRUD app with react</ListItem>
<ListItem>How to create a responsive app using ChakraUi</ListItem>
<ListItem>How to use animations with framer-motion</ListItem>
<ListItem>How to create slider with framer-motion</ListItem>
</UnorderedList>
</Box>
</VStack>
<VStack spacing={5} align={"start"} mt={6}>
<Header fontSize={"xl"} mt={0} mb={0}>
Built with
</Header>
<Box fontSize="md">
<UnorderedList textAlign="left" paddingLeft={5} m={0}>
<ListItem>
Programming language -{" "}
<Link
href="https://www.typescriptlang.org/"
isExternal
color={"blue.500"}
>
Typescript
</Link>
</ListItem>
<ListItem>
Front-end library -{" "}
<Link
href="https://github.com/facebook/react/"
isExternal
color={"blue.500"}
>
React
</Link>
</ListItem>
<ListItem>
UI components -{" "}
<Link href="https://chakra-ui.com/" isExternal color={"blue.500"}>
Chakra-ui
</Link>
</ListItem>
<ListItem>
Animation library -{" "}
<Link
href="https://www.framer.com/motion/"
isExternal
color={"blue.500"}
>
Framer motion
</Link>
</ListItem>
<ListItem>
Notes display -{" "}
<Link
href="https://github.com/tsuyoshiwada/react-stack-grid"
isExternal
color={"blue.500"}
>
react-stack-grid
</Link>
</ListItem>
<ListItem>
Forms Validation -{" "}
<Link
href="https://react-hook-form.com/"
isExternal
color={"blue.500"}
>
React hook form
</Link>
</ListItem>
<ListItem>
Icons -{" "}
<Link
href="https://react-icons.github.io/react-icons/"
isExternal
color={"blue.500"}
>
React icons
</Link>
</ListItem>
<ListItem>
Images placeholder -{" "}
<Link href="https://blurha.sh/" isExternal color={"blue.500"}>
blurhash
</Link>
</ListItem>
<ListItem>
Progressive image loading -{" "}
<Link
href="https://github.com/FormidableLabs/react-progressive-image"
isExternal
color={"blue.500"}
>
react-progressive-image
</Link>
</ListItem>
</UnorderedList>
</Box>
</VStack>
</>
);
}
Example #10
Source File: home.tsx From portfolio with MIT License | 4 votes |
Home = () => {
return (
<Flex direction="column" align="center">
<Flex direction={["column", "column", "row"]}>
<MotionBox
opacity="0"
initial={{
translateX: -150,
opacity: 0
}}
animate={{
translateX: 0,
opacity: 1,
transition: {
duration: ANIMATION_DURATION
}
}}
m="auto"
mb={[16, 16, "auto"]}
>
<Avatar
size={"2xl"}
src={UserIcon}
// src={"https://avatars2.githubusercontent.com/u/37842853?v=4"}
/>
</MotionBox>
<MotionFlex
ml={["auto", "auto", 16]}
m={["auto", "initial"]}
w={["90%", "85%", "80%"]}
maxW="800px"
opacity="0"
justify="center"
direction="column"
initial={{
opacity: 0,
translateX: 150
}}
animate={{
opacity: 1,
translateX: 0,
transition: {
duration: ANIMATION_DURATION
}
}}
>
<Header underlineColor={ORANGE} emoji="?" mt={0} className="face">
Hey!
</Header>
<Box as="h2" fontSize="2xl" fontWeight="400" textAlign="left">
My name is{" "}
<Box as="strong" fontWeight="600">
Ahmad
</Box>{" "}
and I'm a{" "}
<Box as="span" whiteSpace="nowrap">
Full Stack Developer and
</Box>{" "}
<Box as="span" whiteSpace="nowrap">
an open source lover
</Box>
from{" "}
<Box as="span" whiteSpace="nowrap">
Pakistan ??
</Box>
</Box>
<Box as="h2" fontSize="2xl" fontWeight="400" mt={5} textAlign="left">
This is my digital garden, where I write about the things I'm
working on and share what I've learned. ?
</Box>
</MotionFlex>
</Flex>
<MotionBox
w="100%"
opacity="0"
initial={{
translateY: 80
}}
animate={{
translateY: 0,
opacity: 1,
transition: {
delay: ANIMATION_DURATION - 0.1,
duration: ANIMATION_DURATION
}
}}
>
<Box mt={10}>
<Stack
mb={10}
mx={[0, 0, 10]}
padding={4}
align="start"
borderLeft="4px solid"
borderColor={"#53c8c4"}
color={"whatsapp"}
_hover={{ shadow: "lg" }}
backgroundColor={useColorModeValue("gray.100", "#1e2533")}
rounded="sm"
fontSize="md"
>
<Text textAlign="center" color="#53c8c4" fontWeight="bold">
Highlights
</Text>
<UnorderedList textAlign="left" paddingLeft={5} m={0}>
<ListItem>
<Link as={NavLink} to="/open-source">
Live/Local Github Repos
<Badge ml="1" colorScheme="green">
New
</Badge>
</Link>
</ListItem>
<ListItem>
<Link as={NavLink} to="/story-timeline">
Story page
</Link>
</ListItem>
<ListItem>
<Link as={NavLink} to="/tech-stack">
Tech Stack
</Link>
</ListItem>
<ListItem>
<Link as={NavLink} to="/achievements">
Achievements
</Link>
</ListItem>
</UnorderedList>
</Stack>
<Projects projects={projectsList} />
</Box>
</MotionBox>
</Flex>
);
}
Example #11
Source File: Login.tsx From dope-monorepo with GNU General Public License v3.0 | 4 votes |
export default function Login(props: Props) {
const toast = createStandaloneToast(theme);
const [ loading, setLoading ] = useState(false);
const [ loggedIn, setLoggedIn ] = useState(false);
useEffect(() => {
props.manager.events.on('loggedIn', () => setLoading(true));
}, []);
const login = () => {
if ((window.ethereum as any).chainId !== '0x1') {
toast({
title: "Wrong network",
description: "Please switch to the main Ethereum network",
status: "error",
...toastStyle,
});
return;
}
props.authenticator.login()
.then(() => {
setLoggedIn(true)
toast({
title: "Success",
description: "You have successfully logged in!",
status: "success",
...toastStyle
});
})
.catch((err) => {
setLoggedIn(false);
toast({
title: "Error " + (err.code ?? ""),
description: err.message ?? err,
status: "error",
...toastStyle
});
});
}
return (
<ChakraProvider theme={theme}>
<Center style={{
height: "100vh",
backdropFilter: "brightness(50%)",
}}>
{loading ? <Spinner size="xl" color="white" /> : <Container style={{
padding: "1rem",
borderStyle: "solid",
boxShadow: "0px 0px 15px rgba(0,0,0,1)",
borderColor: "black",
borderWidth: "0px",
backgroundColor: "white",
borderRadius: "7px",
}}>
<VStack>
<Heading>
Please login before accessing the game
</Heading>
<br />
<Text>
To login, you need to sign a message using your wallet provider. Our personal favorite is Metamask but you can use any other extension or wallet provider.
</Text>
<UnorderedList spacing={4} style={{
paddingLeft: "1rem",
}}>
<ListItem>
Click on this button to trigger the sign message
<br />
<Button variant="primary" onClick={login}>
Sign
</Button>
</ListItem>
<ListItem>Your wallet provider will popup a dialog and you will need to press `Sign`</ListItem>
<ListItem>
Wait for this to show as logged in
<HStack style={{
paddingLeft: "1rem",
paddingRight: "1rem",
}}>
{loggedIn ? <CheckIcon /> : <Spinner color='red.500' />}
<Text style={{
paddingTop: "1rem",
}}>{loggedIn ? 'Logged in' : 'Not logged in'}</Text>
</HStack>
</ListItem>
<ListItem>Press continue</ListItem>
</UnorderedList>
<Button
disabled={!loggedIn}
onClick={() => props.manager.events.emit('loggedIn')}
style={{
position: "relative",
top: "30px"
}}
variant="primary"
>
Continue
</Button>
</VStack>
</Container>}
</Center>
</ChakraProvider>
);
}
Example #12
Source File: faq.tsx From coindrop with GNU General Public License v3.0 | 4 votes |
accordionText: AccordionText[] = [
{
title: "How are there no fees?",
body: (
<Box>
<Text mb="1rem">
Coindrop does not process any payments.
</Text>
<Text mb="0.25rem">
Transactions are either sent:
</Text>
<UnorderedList mb="1rem">
<ListItem>Peer-to-peer (e.g. Bitcoin)</ListItem>
<ListItem>Through a payment provider of choice (e.g. PayPal)</ListItem>
</UnorderedList>
<Text mb="1rem">
{'Depending on the payment method senders choose, there may be a small transaction fee for them. '}
<b>That's the beauty of Coindrop - senders can choose the payment method with the lowest transaction fee.</b>
</Text>
</Box>
),
},
{
title: "How does this site make money?",
body: (
<Box>
<Text mb="1rem">
To cover costs and fund development of this site, we may display relevant advertisements, offers, and affiliate links.
</Text>
<Text>
Keep in mind the code to this website is open-source so if we ever implemented obtrusive monetization tactics, you could always fork the project on Github :)
</Text>
</Box>
),
},
{
title: "What if one of my payment methods is not listed?",
body: (
<Text>
{"We will add any payment method option as long as it's safe and not against the law. Submit a request "}
<Link
href={githubAddPaymentMethodRequest}
isExternal
>
<u>here</u>
</Link>
.
</Text>
),
},
{
title: "Who created this?",
body: (
<Box>
<Text>
<Link
href={`${markJacksonWebsite}/about`}
isExternal
>
<u>Mark Jackson</u>
</Link>
</Text>
</Box>
),
},
{
title: "How can I contribute?",
body: (
<Text>
{'Submit feature requests, report bugs, and contribute code on our public '}
<Link href={githubUrl} isExternal>
<u>Github</u>
</Link>
{' page.'}
</Text>
),
},
{
title: "How can I support?",
body: (
<>
<Text>
{'Donate at '}
<NextLink href="/coindrop" passHref>
<Link>
<u>coindrop.to/coindrop</u>
</Link>
</NextLink>
</Text>
<Text>
{'Give us a Like on '}
<Link href="https://alternativeto.net/software/coindrop/" isExternal>
<u>AlternativeTo.net</u>
</Link>
</Text>
<Text mt={2}>
Thank you! ?
</Text>
</>
),
},
]