Skip to content
This repository has been archived by the owner on Mar 4, 2020. It is now read-only.

feat(Label): added image and imagePosition props #55

Merged
merged 31 commits into from
Sep 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
32f1b81
-added image shorthand to the label component
Aug 7, 2018
5ab51a9
Merge branch 'master' into feat/label-image-prop
Aug 7, 2018
14799ca
Merge branch 'master' into feat/label-image-prop
mnajdova Aug 7, 2018
500810f
-update changelog
Aug 7, 2018
828a13c
Merge remote-tracking branch 'origin/feat/label-image-prop' into feat…
Aug 7, 2018
e31bdbc
-extract label height in a method
Aug 7, 2018
0aeab96
Merge branch 'master' into feat/label-image-prop
Aug 9, 2018
c1a7117
-replaced image, icon, iconPosition with start and end
Aug 9, 2018
3249b01
-updated changelog
Aug 9, 2018
d1cbd91
-updated layout styles to align the content int he start and end in m…
Aug 9, 2018
c7ed6cc
Merge branch 'master' into feat/label-image-prop
Aug 13, 2018
ba3b5be
-refactoring Label to work with icon, iconPosition, image and imagePo…
Aug 13, 2018
b3001e4
-fixes
Aug 13, 2018
12652e9
-updated CHANGELOG
Aug 13, 2018
4ca94e6
-added test for handling the tabIndex property set to the icon with o…
Aug 13, 2018
29185e8
Merge branch 'master' into feat/label-image-prop
Aug 23, 2018
74a2819
-merge conflicts
Aug 23, 2018
58c47ba
-handling cursor pointer if the icon has onClick prop
Aug 23, 2018
211f372
-remove margin from the label styles
Aug 23, 2018
b8afd16
Merge branch 'master' into feat/label-image-prop
mnajdova Aug 23, 2018
59b145a
Merge branch 'master' into feat/label-image-prop
Aug 23, 2018
0d0cfe8
Merge branch 'feat/label-image-prop' of https://github.com/stardust-u…
Aug 23, 2018
b0ea6c5
Merge branch 'master' into feat/label-image-prop
Aug 27, 2018
ad24d4f
-updated with latest master, fixed changelog, added shorthand tests
Aug 27, 2018
3b96351
Merge branch 'master' into feat/label-image-prop
Aug 30, 2018
bc1d0e6
-merge conflicts
Sep 3, 2018
0cb6d1b
Merge branch 'master' into feat/label-image-prop
Sep 3, 2018
e31fed7
-fixed changelog
Sep 3, 2018
dbafa51
Merge branch 'master' into feat/label-image-prop
Sep 3, 2018
e0a86a9
Merge branch 'master' into feat/label-image-prop
Sep 4, 2018
61aaa6d
Merge branch 'master' into feat/label-image-prop
Sep 5, 2018
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
- Adding `behaviors` section to the menu, under the components @kolaps33 ([#119](https://github.com/stardust-ui/react/pull/119))
- Add `avatar` prop to `Chat.Message` subcomponent @Bugaa92 ([#159](https://github.com/stardust-ui/react/pull/159))
- add `iconOnly` prop to `Button` @mnajdova ([#182](https://github.com/stardust-ui/react/pull/182))
- Add Label `image` and `imagePosition`, removed `onIconClick` prop @mnajdova ([#55](https://github.com/stardust-ui/react/pull/55/))

<!--------------------------------[ v0.5.0 ]------------------------------- -->
## [v0.5.0](https://github.com/stardust-ui/react/tree/v0.5.0) (2018-08-30)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react'
import { Label } from '@stardust-ui/react'

class LabelExampleOnIconClickShorthand extends React.Component {
class LabelExampleContentCustomizationShorthand extends React.Component {
state = { hidden: false }

hide = () => {
Expand All @@ -16,14 +16,19 @@ class LabelExampleOnIconClickShorthand extends React.Component {

return (
<Label
content="You can remove me!"
circular
content="Removable label"
icon="close"
iconPosition="end"
onIconClick={this.hide}
image={{
src: 'public/images/avatar/small/matt.jpg',
avatar: true,
}}
icon={{
name: 'close',
onClick: this.hide,
}}
/>
)
}
}

export default LabelExampleOnIconClickShorthand
export default LabelExampleContentCustomizationShorthand
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
import { Label } from '@stardust-ui/react'

const LabelExampleIconShorthand = () => <Label icon="coffee" content="Label containing icon" />
const LabelExampleIconShorthand = <Label content="Label with icon" icon="close" />

export default LabelExampleIconShorthand
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import React from 'react'
import { Label } from '@stardust-ui/react'

const LabelExampleIconPositionShorthand = (
<Label content="Have a coffee!" icon="coffee" iconPosition="start" />
)

export default LabelExampleIconPositionShorthand
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import React from 'react'
import { Label } from '@stardust-ui/react'

const LabelExampleImageShorthand = () => (
<Label content="John Doe" image="public/images/avatar/small/matt.jpg" />
)

export default LabelExampleImageShorthand
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import React from 'react'
import { Label } from '@stardust-ui/react'

const LabelExampleImageShorthand = () => (
<Label content="John Doe" image="public/images/avatar/small/matt.jpg" imagePosition="end" />
)

export default LabelExampleImageShorthand
40 changes: 40 additions & 0 deletions docs/src/examples/components/Label/Content/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import React from 'react'
import ComponentExample from 'docs/src/components/ComponentDoc/ComponentExample'
import ExampleSection from 'docs/src/components/ComponentDoc/ExampleSection'

const Content = () => (
<ExampleSection title="Content">
<ComponentExample
title="Label"
description="A label."
examplePath="components/Label/Content/LabelExample"
/>
<ComponentExample
title="Image"
description="A label can contain image."
examplePath="components/Label/Content/LabelExampleImage"
/>
<ComponentExample
title="Image position"
description="The image in the Label can be positioned to appear in the ending of the Label."
examplePath="components/Label/Content/LabelExampleImagePosition"
/>
<ComponentExample
title="Icon"
description="A label can contain icon."
examplePath="components/Label/Content/LabelExampleIcon"
/>
<ComponentExample
title="Icon position"
description="The icon in the Label can be positioned to appear in the starting of the Label."
examplePath="components/Label/Content/LabelExampleIconPosition"
/>
<ComponentExample
title="Content customization"
description="The content props in the label can be customized."
examplePath="components/Label/Content/LabelExampleContentCustomization"
/>
</ExampleSection>
)

export default Content
15 changes: 0 additions & 15 deletions docs/src/examples/components/Label/Types/index.tsx

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

20 changes: 0 additions & 20 deletions docs/src/examples/components/Label/Variations/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,6 @@ const Variations = () => (
description="A label can be circular."
examplePath="components/Label/Variations/LabelExampleCircular"
/>
<ComponentExample
title="Icon"
description="The label can contain an icon."
examplePath="components/Label/Variations/LabelExampleIcon"
/>
<ComponentExample
title="Icon position"
description="The icon inside the label can be aligned before or after the content."
examplePath="components/Label/Variations/LabelExampleIconPosition"
/>
<ComponentExample
title="Clickable icon"
description="The icon inside the label can be clickable."
examplePath="components/Label/Variations/LabelExampleOnIconClick"
/>
<ComponentExample
title="Icon props"
description="You can define the Icon props inside the Label."
examplePath="components/Label/Variations/LabelExampleIconProps"
/>
</ExampleSection>
)

Expand Down
4 changes: 2 additions & 2 deletions docs/src/examples/components/Label/index.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React from 'react'
import Types from './Types'
import Content from './Content'
import Variations from './Variations'

const LabelExamples = () => (
<div>
<Types />
<Content />
<Variations />
</div>
)
Expand Down
6 changes: 5 additions & 1 deletion src/components/Image/Image.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as PropTypes from 'prop-types'
import * as React from 'react'

import { customPropTypes, UIComponent } from '../../lib'
import { createShorthandFactory, customPropTypes, UIComponent } from '../../lib'
import { ImageBehavior } from '../../lib/accessibility'
import { Accessibility } from '../../lib/accessibility/interfaces'

Expand Down Expand Up @@ -34,6 +34,8 @@ export interface IImageProps {
* - when alt property is used in combination with aria-label, arialabbeledby or title, additional screen readers verification is needed as each screen reader handles this combination differently.
*/
class Image extends UIComponent<Extendable<IImageProps>, any> {
static create: Function

static className = 'ui-image'

static displayName = 'Image'
Expand Down Expand Up @@ -85,4 +87,6 @@ class Image extends UIComponent<Extendable<IImageProps>, any> {
}
}

Image.create = createShorthandFactory(Image, src => ({ src }))

export default Image
Loading