ConsenSysMesh / rimble-ui

React components that implement Rimble's Design System.
https://rimble.consensys.design/
MIT License
462 stars 67 forks source link

Modals aren't mobile-friendly #397

Closed MikeLockz closed 4 years ago

MikeLockz commented 4 years ago

Describe the bug When a modal appears on mobile, it is cutoff and not visible when the content extends beyond the window width.

To Reproduce https://rimble.consensys.design/components/rimble-ui/Modal#gatsby-focus-wrapper

Expected behavior Modals should be responsive.

Screenshots image

Rimble UI Version

Additional context Add any other context about the problem here.

gesquinca commented 4 years ago

@MikeLockz this isn't a rimble-ui bug. The component in the example has a width of 420px, so the width is going to be 420px. The component in the example should have maxWidth={'100%'} set.

gesquinca commented 4 years ago

I would update the example to this:

<React.Fragment>
        <Button onClick={this.openModal}>Open Modal</Button>
        <Modal isOpen={this.state.isOpen}>
          <Card width={'420px'} maxWidth={'100%'} p={0}>
            <Button.Text
              icononly
              icon={'Close'}
              mainColor={'moon-gray'}
              position={'absolute'}
              top={0}
              right={0}
              mt={3}
              mr={3}
              onClick={this.closeModal}
            />
            <Box p={4} mb={3}>
              <Heading fontSize={3} mb={3} mr={4}>
                Confirm {'{'}Action Name{'}'}
              </Heading>
              <Text>
                Are you sure you want to {'{'}Action Name{'}'}?
              </Text>
            </Box>
            <Flex
              flexDirection={['column', 'row-reverse']}
              justifyContent={'flex-start'}
              px={4}
              py={3}
              borderTop={1}
              borderColor={'blacks.3'}
            >
              <Button ml={[0, 3]} mb={[2, 0]}>Confirm</Button>
              <Button.Outline >Cancel</Button.Outline>
            </Flex>
          </Card>
        </Modal>
      </React.Fragment>