react-awesome-styled-grid icon indicating copy to clipboard operation
react-awesome-styled-grid copied to clipboard

<Row> and <Col> requires style={{ height: '100%' }}

Open diegoarcega opened this issue 4 years ago • 2 comments

problem

image

I am having to add this inline style to the Row and Col in order for my layout to stretch vertically and takes the full height of the area I want.

image

Isn't there a more elegant way of doing this with this component?

diegoarcega avatar Apr 21 '20 13:04 diegoarcega

Hi @diegoarcega, how are you? Analyzing this behavior, I think that the grid should keep each Row with the height of its content. Otherwise, whoever uses Row would have to force the opposite behavior. What you can do is create a styled row using styled-components for example. Something like that:

import { Container, Row as AwesomeRow, Col } from 'react-awesome-styled-grid'
import styled from 'styled-components'

const Row = styled(AwesomeRow)`
  height: 100%;
  // ... more styles here
`
<Container>
  <Row>
    <Col>
      <Form>
        { ... }
      </Form>
    </Col>
  </Row>
</Container>

Makes sense?

santosfrancisco avatar May 03 '20 22:05 santosfrancisco

I'm alright with doing that, I was just expecting a more elegant way of doing this, maybe pass a props down to Row and Col,

<Container>
  <Row fullHeight>
    <Col fullHeight>
      <Form>
        { ... }
      </Form>
    </Col>
  </Row>
</Container>

Do you think that adding this feature would hurt the essentials of the lib?

diegoarcega avatar May 04 '20 12:05 diegoarcega