Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | import { Box, color, Flex, Text } from '@stacks/ui'; import { StacksNode } from '@store/stacks-node'; import React, { FC } from 'react'; interface NodeSelectItemProps { node: StacksNode; activeNode: StacksNode; index: number; onChange(activeNodeId: string): void; onEdit(): void; onDelete(activeNodeId: string): void; } export const NodeSelectItem: FC<NodeSelectItemProps> = props => { const { node, activeNode, index, onChange, onEdit, onDelete } = props; return ( <Flex minHeight="72px" p="base" as="label" borderTop={index > 0 ? `1px solid ${color('border')}` : 'unset'} htmlFor={node.id} > <Flex width="100%" align-items="stretch"> <Box position="relative" top="-3px"> <input type="radio" id={node.id} name="select-node" value={node.id} checked={node.id === activeNode.id} onChange={e => onChange(e.target.value)} /> </Box> <Flex ml="base-tight" width="100%" flexDirection={['column', 'row']}> <Box> <Text textStyle="body.small" fontWeight={500} display="block" style={{ wordBreak: 'break-all' }} > {node.name} </Text> <Text textStyle="caption" display="block" color={color('text-caption')} mt="extra-tight" style={{ wordBreak: 'break-all' }} > {node.url} </Text> </Box> <Flex justifyContent={['flex-start', 'flex-end']} flexGrow={1} alignItems="baseline"> {activeNode.id === node.id && node.id !== 'default' && ( <> <Box as="button" textStyle="body.small.medium" mr="base" ml={[null, null, 'base']} color={color('brand')} outline={0} mt={['tight', 'unset']} _focus={{ textDecoration: 'underline' }} onClick={() => onEdit()} > Edit </Box> <Box as="button" textStyle="body.small.medium" color={color('feedback-error')} mt={['tight', 'unset']} outline={0} _focus={{ textDecoration: 'underline' }} onClick={() => onDelete(activeNode.id)} > Delete </Box> </> )} </Flex> </Flex> </Flex> </Flex> ); }; |