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

Commit adae2df

Browse files
authored
chore(Indicator): use predefined icon set (#1120)
* -initial commit * -temporary adding option icon names * -renamed icons * -added base theme icons * -unset rtl styles from base theme icon styles * -addressing comments on the PR * -addressing comments on the PR * -changed icon names in the MenuItem component * -removed color related things from the base theme icon styles * -removed unused props * -fixed menu slot class names -fixed input test * -fixed menu slot class names -fixed input test * -removed Indicator from App.tsx * -addressed PR comments * -fixed rotate behavior * -reverted recent changes to Menu * -updated changelog * -reverted changes in the Menu
1 parent b50927b commit adae2df

File tree

31 files changed

+231
-257
lines changed

31 files changed

+231
-257
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
2020
### Fixes
2121
- Update vertical && pointing `Menu` styles @jaanus03 ([#1116](https://github.com/stardust-ui/react/pull/1116))
2222

23+
### BREAKING CHANGES
24+
- Remove `Indicator` component, the usages should be replaced with the `Icon` component @mnajdova ([#1120](https://github.com/stardust-ui/react/pull/1120))
25+
26+
### Features
27+
- Add predefined icon set for the usages in the `Input`, `Dropdown` and `AccordionTitle` components @mnajdova ([#1120](https://github.com/stardust-ui/react/pull/1120))
28+
2329
<!--------------------------------[ v0.25.1 ]------------------------------- -->
2430
## [v0.25.1](https://github.com/stardust-ui/react/tree/v0.25.1) (2019-03-29)
2531
[Compare changes](https://github.com/stardust-ui/react/compare/v0.25.0...v0.25.1)

build/gulp/tasks/test-projects/cra/App.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import {
88
Header,
99
Icon,
1010
Image,
11-
Indicator,
1211
Input,
1312
Popup,
1413
Provider,
@@ -31,7 +30,6 @@ class App extends React.Component {
3130
<Divider />
3231
<Header content="This is " />
3332
<Image src="//placehold.it" />
34-
<Indicator />
3533
<Input placeholder="Type here" />
3634
<Popup trigger={<Button content="Popup" />} content="Popup content" />
3735
</div>

docs/src/components/ComponentDoc/ComponentSidebar/ComponentSidebarSection.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as _ from 'lodash'
22
import * as PropTypes from 'prop-types'
33
import * as React from 'react'
4-
import { Indicator, Tree } from '@stardust-ui/react'
4+
import { Icon, Tree } from '@stardust-ui/react'
55

66
import { examplePathToHash } from 'docs/src/utils'
77

@@ -98,7 +98,7 @@ export default class ComponentSidebarSection extends React.PureComponent<any, an
9898
active={active}
9999
>
100100
<span>{content}</span>
101-
{hasSubtree && <Indicator direction={open ? 'bottom' : 'start'} />}
101+
{hasSubtree && <Icon direction={name ? 'arrow-down' : 'arrow-end'} />}
102102
</Component>
103103
)
104104

docs/src/examples/components/Indicator/Rtl/IndicatorExample.rtl.tsx

Lines changed: 0 additions & 13 deletions
This file was deleted.

docs/src/examples/components/Indicator/Rtl/index.tsx

Lines changed: 0 additions & 12 deletions
This file was deleted.

docs/src/examples/components/Indicator/Types/IndicatorExample.shorthand.tsx

Lines changed: 0 additions & 6 deletions
This file was deleted.

docs/src/examples/components/Indicator/Types/IndicatorExampleDirection.shorthand.tsx

Lines changed: 0 additions & 13 deletions
This file was deleted.

docs/src/examples/components/Indicator/Types/IndicatorExampleIcon.shorthand.tsx

Lines changed: 0 additions & 12 deletions
This file was deleted.

docs/src/examples/components/Indicator/Types/index.tsx

Lines changed: 0 additions & 25 deletions
This file was deleted.

docs/src/examples/components/Indicator/index.tsx

Lines changed: 0 additions & 13 deletions
This file was deleted.

packages/react/src/components/Accordion/AccordionTitle.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
rtlTextContainer,
1515
} from '../../lib'
1616
import { ReactProps, ComponentEventHandler, ShorthandValue } from '../../types'
17-
import Indicator from '../Indicator/Indicator'
17+
import Icon from '../Icon/Icon'
1818
import Layout from '../Layout/Layout'
1919

2020
export interface AccordionTitleProps
@@ -67,9 +67,9 @@ class AccordionTitle extends UIComponent<ReactProps<AccordionTitleProps>, any> {
6767

6868
const contentElement = (
6969
<Layout
70-
start={Indicator.create(indicatorWithDefaults, {
70+
start={Icon.create(indicatorWithDefaults, {
7171
defaultProps: {
72-
direction: active ? 'bottom' : 'end',
72+
name: active ? 'stardust-arrow-down' : 'stardust-arrow-end',
7373
styles: styles.indicator,
7474
},
7575
})}

packages/react/src/components/Dropdown/Dropdown.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ import {
3030
handleRef,
3131
UIComponentProps,
3232
} from '../../lib'
33-
import Indicator, { IndicatorProps } from '../Indicator/Indicator'
3433
import List from '../List/List'
3534
import Ref from '../Ref/Ref'
3635
import DropdownItem from './DropdownItem'
@@ -279,7 +278,7 @@ class Dropdown extends AutoControlledComponent<Extendable<DropdownProps>, Dropdo
279278

280279
static defaultProps: DropdownProps = {
281280
as: 'div',
282-
clearIndicator: 'close',
281+
clearIndicator: 'stardust-close',
283282
itemToString: item => {
284283
if (!item || React.isValidElement(item)) {
285284
return ''
@@ -403,14 +402,14 @@ class Dropdown extends AutoControlledComponent<Extendable<DropdownProps>, Dropdo
403402
},
404403
}),
405404
})
406-
: Indicator.create(toggleIndicator, {
405+
: Icon.create(toggleIndicator, {
407406
defaultProps: {
408407
className: Dropdown.slotClassNames.toggleIndicator,
409-
direction: open ? 'top' : 'bottom',
408+
name: open ? 'stardust-arrow-up' : 'stardust-arrow-down',
410409
styles: styles.toggleIndicator,
411410
},
412-
overrideProps: (predefinedProps: IndicatorProps) => ({
413-
onClick: (e, indicatorProps: IndicatorProps) => {
411+
overrideProps: (predefinedProps: IconProps) => ({
412+
onClick: (e, indicatorProps: IconProps) => {
414413
_.invoke(predefinedProps, 'onClick', e, indicatorProps)
415414
getToggleButtonProps().onClick(e)
416415
},

packages/react/src/components/Indicator/Indicator.tsx

Lines changed: 0 additions & 83 deletions
This file was deleted.

packages/react/src/components/Input/Input.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ class Input extends AutoControlledComponent<ReactProps<InputProps>, InputState>
203203
const { value } = this.state
204204

205205
if (clearable && (value as string).length !== 0) {
206-
return 'close'
206+
return 'stardust-close'
207207
}
208208

209209
return icon || null

packages/react/src/components/Menu/MenuItem.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import { Accessibility, AccessibilityActionHandlers } from '../../lib/accessibil
2626
import { ComponentEventHandler, ReactProps, ShorthandValue } from '../../types'
2727
import { focusAsync } from '../../lib/accessibility/FocusZone'
2828
import Ref from '../Ref/Ref'
29-
import Indicator from '../Indicator/Indicator'
3029

3130
export interface MenuItemSlotClassNames {
3231
wrapper: string
@@ -216,9 +215,9 @@ class MenuItem extends AutoControlledComponent<ReactProps<MenuItemProps>, MenuIt
216215
})}
217216
{rtlTextContainer.createFor({ element: content })}
218217
{menu &&
219-
Indicator.create(indicatorWithDefaults, {
218+
Icon.create(indicatorWithDefaults, {
220219
defaultProps: {
221-
direction: vertical ? 'end' : 'bottom',
220+
name: vertical ? 'stardust-arrow-end' : 'stardust-arrow-down',
222221
styles: styles.indicator,
223222
},
224223
})}

packages/react/src/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,6 @@ export { default as Animation, AnimationProps } from './components/Animation/Ani
152152

153153
export { default as Tree } from './components/Tree'
154154

155-
export { default as Indicator, IndicatorProps } from './components/Indicator/Indicator'
156-
157155
export { default as Reaction, ReactionProps, ReactionState } from './components/Reaction/Reaction'
158156
export { default as ReactionGroup, ReactionGroupProps } from './components/Reaction/ReactionGroup'
159157

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
export { default as Dialog } from './components/Dialog/dialogStyles'
2+
export { default as Icon } from './components/Icon/iconStyles'
23
export { default as Loader } from './components/Loader/loaderStyles'
34
export { default as ProviderBox } from './components/Provider/providerBoxStyles'
45
export { default as Text } from './components/Text/textStyles'
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
export { default as Dialog } from './components/Dialog/dialogVariables'
2+
export { default as Icon } from './components/Icon/iconVariables'
23
export { default as Loader } from './components/Loader/loaderVariables'
34
export { default as ProviderBox } from './components/Provider/providerBoxVariables'
45
export { default as Text } from './components/Text/textVariables'

0 commit comments

Comments
 (0)