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

[Hidden] Update initialWidth propTypes #9815

Merged
merged 3 commits into from
Jan 10, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion pages/api/hidden.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Responsively hides children based on the selected implementation.
|:-----|:-----|:--------|:------------|
| children | node | | The content of the component. |
| implementation | enum:&nbsp;'js'&nbsp;&#124;<br>&nbsp;'css'<br> | 'js' | Specify which implementation to use. 'js' is the default, 'css' works better for server side rendering. |
| initialWidth | number | | You can use this property when choosing the `js` implementation with server side rendering.<br>As `window.innerWidth` is unavailable on the server, we default to rendering an empty componenent during the first mount. In some situation you might want to use an heristic to approximate the screen width of the client browser screen width.<br>For instance, you could be using the user-agent or the client-hints. http://caniuse.com/#search=client%20hint |
| initialWidth | enum:&nbsp;'xs', 'sm', 'md', 'lg', 'xl'<br> | | You can use this property when choosing the `js` implementation with server side rendering.<br>As `window.innerWidth` is unavailable on the server, we default to rendering an empty componenent during the first mount. In some situation you might want to use an heristic to approximate the screen width of the client browser screen width.<br>For instance, you could be using the user-agent or the client-hints. http://caniuse.com/#search=client%20hint |
| lgDown | bool | false | If true, screens this size and down will be hidden. |
| lgUp | bool | false | If true, screens this size and up will be hidden. |
| mdDown | bool | false | If true, screens this size and down will be hidden. |
Expand Down
17 changes: 9 additions & 8 deletions src/Hidden/Hidden.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,19 @@ import { StandardProps } from '..';
import { Breakpoint } from '../styles/createBreakpoints';

export interface HiddenProps extends StandardProps<{}, never> {
implementation?: 'js' | 'css';
initialWidth?: Breakpoint;
lgDown?: boolean;
lgUp?: boolean;
mdDown?: boolean;
mdUp?: boolean;
only?: Breakpoint | Array<Breakpoint>;
xsUp?: boolean;
smDown?: boolean;
smUp?: boolean;
mdUp?: boolean;
lgUp?: boolean;
xlDown?: boolean;
xlUp?: boolean;
xsDown?: boolean;
smDown?: boolean;
mdDown?: boolean;
lgDown?: boolean;
xlDown?: boolean;
implementation?: 'js' | 'css';
xsUp?: boolean;
}

declare const Hidden: React.ComponentType<HiddenProps>;
Expand Down
2 changes: 1 addition & 1 deletion src/Hidden/Hidden.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Hidden.propTypes = {
* For instance, you could be using the user-agent or the client-hints.
* http://caniuse.com/#search=client%20hint
*/
initialWidth: PropTypes.number,
initialWidth: PropTypes.oneOf(['xs', 'sm', 'md', 'lg', 'xl']),
/**
* If true, screens this size and down will be hidden.
*/
Expand Down
20 changes: 20 additions & 0 deletions src/Hidden/HiddenCss.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import * as React from 'react';
import { Breakpoint } from '../styles/createBreakpoints';

export interface HiddenCssProps {
lgDown?: boolean;
lgUp?: boolean;
mdDown?: boolean;
mdUp?: boolean;
only?: Breakpoint | Array<Breakpoint>;
smDown?: boolean;
smUp?: boolean;
xlDown?: boolean;
xlUp?: boolean;
xsDown?: boolean;
xsUp?: boolean;
}

declare const HiddenCss: React.ComponentType<HiddenCssProps>;

export default HiddenCss;
12 changes: 0 additions & 12 deletions src/Hidden/HiddenCss.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,18 +97,6 @@ HiddenCss.propTypes = {
* side rendering.
*/
implementation: PropTypes.oneOf(['js', 'css']),
/**
* You can use this property when choosing the `js` implementation with server side rendering.
*
* As `window.innerWidth` is unavailable on the server,
* we default to rendering an empty componenent during the first mount.
* In some situation you might want to use an heristic to approximate
* the screen width of the client browser screen width.
*
* For instance, you could be using the user-agent or the client-hints.
* http://caniuse.com/#search=client%20hint
*/
initialWidth: PropTypes.number,
/**
* If true, screens this size and down will be hidden.
*/
Expand Down
15 changes: 8 additions & 7 deletions src/Hidden/HiddenJs.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,18 @@ import * as React from 'react';
import { Breakpoint } from '../styles/createBreakpoints';

export interface HiddenJsProps {
initialWidth?: Breakpoint;
lgDown?: boolean;
lgUp?: boolean;
mdDown?: boolean;
mdUp?: boolean;
only?: Breakpoint | Array<Breakpoint>;
xsUp?: boolean;
smDown?: boolean;
smUp?: boolean;
mdUp?: boolean;
lgUp?: boolean;
xlDown?: boolean;
xlUp?: boolean;
xsDown?: boolean;
smDown?: boolean;
mdDown?: boolean;
lgDown?: boolean;
xlDown?: boolean;
xsUp?: boolean;
}

declare const HiddenJs: React.ComponentType<HiddenJsProps>;
Expand Down
2 changes: 1 addition & 1 deletion src/Hidden/HiddenJs.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ HiddenJs.propTypes = {
* For instance, you could be using the user-agent or the client-hints.
* http://caniuse.com/#search=client%20hint
*/
initialWidth: PropTypes.number,
initialWidth: PropTypes.oneOf(['xs', 'sm', 'md', 'lg', 'xl']),
/**
* If true, screens this size and down will be hidden.
*/
Expand Down
2 changes: 0 additions & 2 deletions src/Hidden/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
export { default } from './Hidden';
export * from './Hidden';
export { default as HiddenJs } from './HiddenJs';
export * from './HiddenJs';
1 change: 0 additions & 1 deletion src/Hidden/index.js
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
export { default } from './Hidden';
export { default as HiddenJs } from './HiddenJs';