Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PropTypes ColProp for shape of labelCol and wrapperCol Props for grid #6810

Closed
enterloper opened this issue Jul 12, 2017 · 3 comments
Closed
Labels
help wanted The suggestion or request has been accepted, we need you to help us by sending a pull request.

Comments

@enterloper
Copy link

What problem does this feature solve?

My team is using a linter that disallows the use of PropTypes.object. Because there are multiple instances where a shape can be formed, for these particular props (wrapperCol and labelCol) I would like to avoid writing the shape in each file or creating my own by copying/pasting with modification from the typescript file. I was hoping a readily made ColProps was available. After looking at the source code I see in ant-design/components/grid/col.tsx that there is a ColProps object that would be perfect to use, but is unavailable from the node_module version my team has. Is ColProps accessible anywhere in the current version?

What does the proposed API look like?

It would be nice to have ColProps available in some format like:

import React from 'react';
import PropTypes from 'prop-types';
import { Col } from 'antd';

const ColProps = Col.PropShape;
const propTypes = {
   layout = PropTypes.shape({
     labelCol: ColProps,
     wrapperCol: ColProps,
  }),
};

<!-- generated by ant-design-issue-helper. DO NOT REMOVE -->
@benjycui benjycui added the help wanted The suggestion or request has been accepted, we need you to help us by sending a pull request. label Jul 13, 2017
@benjycui
Copy link
Contributor

PR is welcomed @richardjboothe

@afc163
Copy link
Member

afc163 commented Jul 31, 2017

ping~

@afc163
Copy link
Member

afc163 commented Aug 4, 2017

You can try this:

import { Col } from 'antd';

PropTypes.shape(Col.propTypes);

@afc163 afc163 closed this as completed Aug 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted The suggestion or request has been accepted, we need you to help us by sending a pull request.
Projects
None yet
Development

No branches or pull requests

3 participants