diff --git a/package-lock.json b/package-lock.json index efc863e80..4155c1138 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5358,9 +5358,9 @@ } }, "fiori-fundamentals": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/fiori-fundamentals/-/fiori-fundamentals-1.3.3.tgz", - "integrity": "sha512-Eg0ah4vvcKhdrAfFfKCgY5obavd17mPtnswKpIOFCPE7PH1osBUIPkKXUDYKyLz9QlQpAmpX1K5dF8GrWzBaFw==", + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/fiori-fundamentals/-/fiori-fundamentals-1.4.0.tgz", + "integrity": "sha512-cLg0frknpwQsRpEsNA7g+Vo1mRjN+80P3Acvs/HnQ9FwCQV8PUOvSaD5evN8HwZr8YwTI116fJ8GX93SDvp+oA==", "dev": true }, "flat-cache": { diff --git a/package.json b/package.json index 318852244..4d17ad698 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "@babel/cli": "^7.1.5", "enzyme": "^3.7.0", "enzyme-adapter-react-16": "^1.7.0", - "fiori-fundamentals": "^1.3.3", + "fiori-fundamentals": "^1.4.0", "gh-pages": "^2.0.1", "jest": "^23.6.0", "react": "^16.6.3", diff --git a/src/Alert/Alert.Component.js b/src/Alert/Alert.Component.js index b1dd4fd2e..bb0358a98 100644 --- a/src/Alert/Alert.Component.js +++ b/src/Alert/Alert.Component.js @@ -1,8 +1,7 @@ import React from 'react'; -import { Alert } from '../'; +import { Alert, Icon } from '../'; import { DocsTile, DocsText, Separator, Header, Description, Import, Properties, Playground } from '../'; - export const AlertComponent = () => { const defaultAlertCode = `Default alert with a `; @@ -11,10 +10,27 @@ export const AlertComponent = () => {

More information...

`; - const errorAlertCode = ` - Error message with a + const errorAlertCode = ` + Error Message. + + Learn More + +`; + + const sucessAlertCode = ` + Message Success. + + Learn More + +`; + + const informationAlertCode = ` + Information Message. + + Learn More + `; - + return (
Alert
@@ -53,7 +69,7 @@ export const AlertComponent = () => { - Default alert with a {' '} + Default alert with a{' '} {defaultAlertCode} @@ -82,14 +98,41 @@ export const AlertComponent = () => { rectified the error. The user will need to dismiss the message. Apply type="error". - - Error message with a {' '} + + Error Message.{' '} + + Learn More + {errorAlertCode} +

Success Alert

+ + + Message Success.{' '} + + Learn More + + + + {sucessAlertCode} + + + +

Information Alert

+ + + Information Message.{' '} + + Learn More + + + + {informationAlertCode} +

Playground

@@ -99,7 +142,7 @@ export const AlertComponent = () => { { attribute: 'type', typeOfAttribute: 'string', - enum: ['', 'warning', 'error'] + enum: ['', 'warning', 'error', 'information', 'success'] }, { attribute: 'dismissable', diff --git a/src/Alert/Alert.js b/src/Alert/Alert.js index c5bbafede..015f23dc6 100644 --- a/src/Alert/Alert.js +++ b/src/Alert/Alert.js @@ -51,7 +51,7 @@ export class Alert extends Component { } Alert.propTypes = { - type: PropTypes.oneOf(['', 'warning', 'error']), + type: PropTypes.oneOf(['', 'warning', 'error', 'success', 'information']), link: PropTypes.string, linkText: PropTypes.string, dismissable: PropTypes.bool diff --git a/src/App.scss b/src/App.scss index 27353c5d3..117333ff5 100644 --- a/src/App.scss +++ b/src/App.scss @@ -6,6 +6,10 @@ $fd-fonts-path: '../node_modules/fiori-fundamentals/dist/fonts/'; background-color: white; } +.fd-counter--notification { + position: relative; +} + .fd-tile__content { .fd-badge, .fd-label, @@ -13,8 +17,8 @@ $fd-fonts-path: '../node_modules/fiori-fundamentals/dist/fonts/'; .fd-token, .fd-dropdown, .fd-button-group, - [class*='fd-identifier'], - { + .fd-counter, + [class*='fd-identifier'] { margin-right: 20px; } diff --git a/src/Badge/Badge.Component.js b/src/Badge/Badge.Component.js index 42421cc72..73d741ade 100644 --- a/src/Badge/Badge.Component.js +++ b/src/Badge/Badge.Component.js @@ -1,38 +1,29 @@ import React from 'react'; -import { Badge, Label, Status } from '../'; -import { - DocsTile, - DocsText, - Separator, - Header, - Description, - Import, - Properties, - Playground -} from '../'; +import { Badge, Label, Status, Counter, Button } from '../'; +import { DocsTile, DocsText, Separator, Header, Description, Import, Properties, Playground } from '../'; export const BadgeComponent = () => { - const defaultBadgeCode = `Default + const defaultBadgeCode = `Default Default Default Default`; - const pillBadgeCode = `Default + const pillBadgeCode = `Default Default Default Default`; - const filledBadgeCode = `Default + const filledBadgeCode = `Default Default Default Default`; - const labelCode = ` + const labelCode = ` `; - const statusCode = `Default + const statusCode = `Default Default Default Default @@ -43,806 +34,853 @@ export const BadgeComponent = () => { Busy Appear Offline`; - const statusIconCode = `Custom Icon + const statusIconCode = `Custom Icon Success Warning Error`; - return ( -
-
Badge and Label
- - Badges and labels are used to indicate status. Colors, generally in - combination with text, are used to easily highlight the state of an - object. The following colors should be used: Black: default or inactive - status; Green: positive status, used for active, published, approved; - Orange: a warning status or to indicate that an action can be taken; - Red: error status. - - - - - - - - - -

Default Badge

- - Default - Default - Default - Default - - {defaultBadgeCode} - - - -

Pill Badge

- - Apply modifier="pill" to render a pill version of the - badge. - - - Default - - Default - - - Default - - - Default - - - {pillBadgeCode} - - - -

Filled Badge

- - Apply modifier="filled" to render a filled version of the - badge. - - - Default - - Default - - - Default - - - Default - - - {filledBadgeCode} - - - -

Label

- - - - - - - {labelCode} - - - -

Status Indicator Label with build in status icons

- - Default - Default - Default - Default -
-
- Available - Away - Busy - Appear Offline -
- {statusCode} - -

Status Indicator Label with any icons

- - Custom Icon - Success - Warning - Error - - {statusIconCode} - - - -

Playground

- - - Default - - - -
- ); + const defaultCounterCode = `5 +25 +101 +999+`; + + const notificationCounterCode = ` + + +`; + + const inlineCounterCode = `

Lorem ipsum 5

`; + + return ( +
+
Status Indicators
+ Status Indicators are used to easily highlight the state of an object. + + + + + + + + +

Default Badge

+ + Default + Default + Default + Default + + {defaultBadgeCode} + + + +

Pill Badge

+ + Apply modifier="pill" to render a pill version of the badge. + + + Default + + Default + + + Default + + + Default + + + {pillBadgeCode} + + + +

Filled Badge

+ + Apply modifier="filled" to render a filled version of the badge. + + + Default + + Default + + + Default + + + Default + + + {filledBadgeCode} + + + +

Label

+ + + + + + + {labelCode} + + + +

Status Indicator Label with build in status icons

+ + Default + Default + Default + Default +
+
+ Available + Away + Busy + Appear Offline +
+ {statusCode} + +

Status Indicator Label with any icons

+ + Custom Icon + Success + Warning + Error + + {statusIconCode} + + + +

Default Counter

+ Counter has a minimum value 1. Maximum display is 999+ + + 5 + 25 + 101 + 999+ + + {defaultCounterCode} + + + +

Counter inline with a paragraph

+ +

+ Lorem ipsum 5 +

+
+ {inlineCounterCode} + + + +

Notification counter

+ Use the property 'notification' to enable notification counter. + + + + + + + {notificationCounterCode} + + + +

Playground

+ + + Default + + + +
+ ); }; diff --git a/src/Badge/Badge.js b/src/Badge/Badge.js index c2a0fc8ea..470c512b0 100644 --- a/src/Badge/Badge.js +++ b/src/Badge/Badge.js @@ -2,49 +2,52 @@ import React from 'react'; import PropTypes from 'prop-types'; export const Badge = props => { - const { type, modifier, children } = props; - return ( - - {children} - - ); + const { type, modifier, children } = props; + return ( + + {children} + + ); }; Badge.propTypes = { - type: PropTypes.oneOf(['', 'success', 'warning' , 'error']), - modifier: PropTypes.oneOf(['', 'pill', 'filled']) + type: PropTypes.oneOf(['', 'success', 'warning', 'error']), + modifier: PropTypes.oneOf(['', 'pill', 'filled']) }; export const Label = props => { - const { type, children } = props; - return ( - - {children} - - ); + const { type, children } = props; + return {children}; }; Label.propTypes = { - type: PropTypes.oneOf(['', 'success', 'warning' , 'error']) + type: PropTypes.oneOf(['', 'success', 'warning', 'error']) }; export const Status = props => { - const { type, glyph, children } = props; - return ( - - {children} - - ); + const { type, glyph, children } = props; + return ( + + {children} + + ); }; Status.propTypes = { - type: PropTypes.oneOf(['', 'success', 'warning' , 'error', 'available', 'away', 'busy', 'offline']), - glyph: PropTypes.string + type: PropTypes.oneOf(['', 'success', 'warning', 'error', 'available', 'away', 'busy', 'offline']), + glyph: PropTypes.string +}; + +export const Counter = props => { + const { notification, children } = props; + return ( + + {children} + + ); +}; + +Counter.propTypes = { + notification: PropTypes.bool }; diff --git a/src/Routes.js b/src/Routes.js index 19bb88b07..17f473b65 100644 --- a/src/Routes.js +++ b/src/Routes.js @@ -55,11 +55,6 @@ export default class Routes extends Component { component: ActionBarComponent }, { url: '/alert', name: 'Alert', component: AlertComponent }, - { - url: '/badge', - name: 'Badge, Label & Status', - component: BadgeComponent - }, { url: '/breadcrumb', name: 'Breadcrumb', @@ -141,6 +136,11 @@ export default class Routes extends Component { name: 'Side Navigation', component: SideNavigationComponent }, + { + url: '/statusIndicators', + name: 'Status Indicators', + component: BadgeComponent + }, { url: '/table', name: 'Table', component: TableComponent }, { url: '/tabs', name: 'Tabs', component: TabsComponent }, { url: '/tile', name: 'Tile', component: TileComponent }, diff --git a/src/index.js b/src/index.js index 713626b45..af9fb171a 100644 --- a/src/index.js +++ b/src/index.js @@ -16,7 +16,8 @@ import { import { Badge, Label, - Status + Status, + Counter } from '../src/Badge/Badge'; import { Breadcrumb, @@ -196,6 +197,7 @@ export { ComboboxInput, Label, Status, + Counter, Breadcrumb, BreadcrumbItem, Button,