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

feat(Gallery): Convert gallery to typescript #2432

Merged
merged 6 commits into from
Jul 5, 2019
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions packages/patternfly-4/react-core/src/layouts/Gallery/Gallery.d.ts

This file was deleted.

36 changes: 0 additions & 36 deletions packages/patternfly-4/react-core/src/layouts/Gallery/Gallery.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import Gallery from './Gallery';
import * as React from 'react';
import { Gallery } from './Gallery';
import { GutterSize } from '../../styles/gutters';
import { shallow } from 'enzyme';

Expand Down
25 changes: 25 additions & 0 deletions packages/patternfly-4/react-core/src/layouts/Gallery/Gallery.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import * as React from 'react';
import { css } from '@patternfly/react-styles';
import styles from '@patternfly/react-styles/css/layouts/Gallery/gallery';

export interface GalleryProps extends React.HTMLProps<HTMLDivElement> {
/** content rendered inside the Gallery layout */
children?: React.ReactNode;
/** additional classes added to the Gallery layout */
className?: string;
/** Adds space between children. */
gutter?: 'sm' | 'md' | 'lg';
}
export const Gallery: React.FunctionComponent<GalleryProps> = ({
children = null,
className = '',
gutter = null,
...props
}: GalleryProps) => (
<div
className={css(styles.gallery, gutter && styles.modifiers.gutter, className)}
{...props}
>
{children}
</div>
);

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import * as React from 'react';

export interface GalleryItemProps extends React.HTMLProps<HTMLDivElement> {
/** content rendered inside the Gallery Item */
children?: React.ReactNode;
}

export const GalleryItem: React.FunctionComponent<GalleryItemProps> = ({
children = null,
...props
}: GalleryItemProps) => (
<div {...props}>{children}</div>
);
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ title: 'Gallery'
cssPrefix: 'pf-l-gallery'
section: 'layouts'
propComponents: ['Gallery', 'GalleryItem']
typescript: true
---

import { Gallery, GalleryItem } from '@patternfly/react-core';
Expand Down

This file was deleted.

2 changes: 0 additions & 2 deletions packages/patternfly-4/react-core/src/layouts/Gallery/index.js

This file was deleted.

2 changes: 2 additions & 0 deletions packages/patternfly-4/react-core/src/layouts/Gallery/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './Gallery';
export * from './GalleryItem';
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
describe('Gallery Demo Test', () => {
it('Navigate to demo section', () => {
cy.visit('http://localhost:3000/');
cy.get('#gallery-demo-nav-item-link').click();
cy.url().should('eq', 'http://localhost:3000/gallery-demo-nav-link');
});
it('Verify gallery item', () => {
cy.get('.pf-c-page__main-section').find('div').first().should('have.class', 'pf-l-gallery');
})

it('Verify gutters', () => {
cy.get('.pf-l-gallery').should('have.class', 'pf-m-gutter');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,11 @@ export const Demos: DemoInterface[] = [
name: 'Form Select Demo',
componentType: Examples.FormSelectDemo
},
{
id: 'gallery-demo',
name: 'Gallery Demo',
componentType: Examples.GalleryDemo
},
{
id: 'input-group-demo',
name: 'Input Group Demo',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import React from 'react';
import { Gallery, GalleryItem } from '@patternfly/react-core';

export class GalleryDemo extends React.Component {
render() {
return (
<Gallery gutter="md">
<GalleryItem>Gallery Item</GalleryItem>
<GalleryItem>Gallery Item</GalleryItem>
<GalleryItem>Gallery Item</GalleryItem>
<GalleryItem>Gallery Item</GalleryItem>
<GalleryItem>Gallery Item</GalleryItem>
<GalleryItem>Gallery Item</GalleryItem>
</Gallery>
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ export * from './ClipboardCopyDemo/ClipboardCopyDemo';
export * from './ContextSelectorDemo/ContextSelectorDemo';
export * from './DataListDemo/DataListDemo';
export * from './EmptyStateDemo/EmptyStateDemo';
export * from './FormDemo/FormDemo';
export * from './FormSelectDemo/FormSelectDemo';
export * from './InputGroupDemo/InputGroupDemo';
export * from './FormDemo/FormDemo';
export * from './FormSelectDemo/FormSelectDemo';
export * from './GalleryDemo/GalleryDemo';
export * from './InputGroupDemo/InputGroupDemo';
export * from './LabelDemo/LabelDemo';
export * from './ListDemo/ListDemo';
export * from './LoginPageDemo/LoginPageDemo';
Expand Down