-
Notifications
You must be signed in to change notification settings - Fork 351
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(brand): Converted brand component to typescript (#1918)
* git mv files * convert js to tsx * Fix linting error
- Loading branch information
1 parent
43d5283
commit 2c52451
Showing
15 changed files
with
100 additions
and
47 deletions.
There are no files selected for viewing
8 changes: 0 additions & 8 deletions
8
packages/patternfly-4/react-core/src/components/Brand/Brand.d.ts
This file was deleted.
Oops, something went wrong.
30 changes: 0 additions & 30 deletions
30
packages/patternfly-4/react-core/src/components/Brand/Brand.js
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
--- | ||
title: 'Brand' | ||
cssPrefix: null | ||
typescript: true | ||
--- | ||
## Simple brand | ||
|
||
|
4 changes: 2 additions & 2 deletions
4
...t-core/src/components/Brand/Brand.test.js → ...-core/src/components/Brand/Brand.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
packages/patternfly-4/react-core/src/components/Brand/Brand.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import * as React from 'react'; | ||
import { css } from '@patternfly/react-styles'; | ||
|
||
export interface BrandProps extends React.DetailedHTMLProps<React.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement> { | ||
/** Additional classes added to the Brand. */ | ||
className?: string; | ||
/** Attribute that specifies the URL of the image for the Brand. */ | ||
src?: string; | ||
/** Attribute that specifies the alt text of the image for the Brand. */ | ||
alt: string; | ||
} | ||
|
||
export const Brand: React.FunctionComponent<BrandProps> = ({ | ||
className = '', | ||
src = '', | ||
alt, | ||
...props | ||
}) => ( | ||
/** the brand component currently contains no styling the 'pf-c-brand' string will be used for the className */ | ||
<img {...props} className={css('pf-c-brand', className)} src={src} alt={alt} /> | ||
); |
File renamed without changes.
1 change: 0 additions & 1 deletion
1
packages/patternfly-4/react-core/src/components/Brand/index.d.ts
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './Brand'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
packages/patternfly-4/react-integration/cypress/integration/brand.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
describe('Brand Demo Test', () => { | ||
it('Navigate to demo section', () => { | ||
cy.visit('http://localhost:3000/'); | ||
cy.get('#brand-demo-nav-item-link').click(); | ||
cy.url().should('eq', 'http://localhost:3000/brand-demo-nav-link'); | ||
}); | ||
|
||
it('Verify has src', () => { | ||
cy.get('img').should('have.attr', 'src') | ||
}); | ||
|
||
it('Verify default alt', () => { | ||
cy.get('img').should('have.attr', 'alt', 'Patternfly Logo') | ||
}); | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
...s/patternfly-4/react-integration/demo-app-ts/src/components/demos/BrandDemo/BrandDemo.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import React from 'react'; | ||
import { Brand } from '@patternfly/react-core'; | ||
import pfLogo from './images/pfLogo.svg'; | ||
|
||
export class BrandDemo extends React.Component { | ||
render() { | ||
return ( | ||
<Brand src={pfLogo} alt="Patternfly Logo" /> | ||
); | ||
} | ||
} | ||
|
||
|
37 changes: 37 additions & 0 deletions
37
.../react-integration/demo-app-ts/src/components/demos/BrandDemo/images/pfLogo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion
3
packages/patternfly-4/react-integration/demo-app-ts/src/components/demos/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters