Skip to content

Commit

Permalink
feat(link): Un-namespace ButtonLink and ChevronLink from Link as they…
Browse files Browse the repository at this point in the history
… are only related, not coupled.
  • Loading branch information
ryanoglesby08 committed Aug 22, 2017
1 parent 74b9916 commit 3a46497
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 24 deletions.
5 changes: 0 additions & 5 deletions config/styleguide.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,6 @@ module.exports = {
name = 'ExpandCollapse'
}

// Link component has name-space sub-components
if (path.dirname(componentPath).includes('Link')) {
name = 'Link'
}

return `import { ${name} } from '@telusdigital/tds';`
},

Expand Down
1 change: 0 additions & 1 deletion src/components/Link/ButtonLink/ButtonLink.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,5 @@ ButtonLink.defaultProps = {
to: null,
href: null
}
ButtonLink.displayName = 'Link.Button'

export default ButtonLink
4 changes: 2 additions & 2 deletions src/components/Link/ButtonLink/ButtonLink.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ A Button Link is a navigational element that styles itself as a button. Clicking
By default, Buttons will be displayed in the `primary` variant. Use primary buttons for the main call to action on a page.

```
<Link.Button href="http://www.telus.com">Find out how</Link.Button>
<ButtonLink href="http://www.telus.com">Find out how</ButtonLink>
```

### Using Button Links
Expand All @@ -27,6 +27,6 @@ is too low, including the hover state.
const Hero = require('../../__docs__/Hero').default;
<Hero>
<Link.Button variant="outlined" invert>Advanced solutions</Link.Button>
<ButtonLink variant="outlined" invert>Advanced solutions</ButtonLink>
</Hero>
```
6 changes: 3 additions & 3 deletions src/components/Link/ButtonLink/__tests__/ButtonLink.spec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ import { shallow } from 'enzyme'

import { warn } from '../../../../warn'

import Link from '../../Link'
import ButtonLink from '../ButtonLink'

jest.mock('../../../../warn', () => (
{ warn: jest.fn() }
))

describe('Link.Button', () => {
describe('ButtonLink', () => {
const doShallow = (overrides = {}) => shallow(
<Link.Button {...overrides}>Go home</Link.Button>
<ButtonLink {...overrides}>Go home</ButtonLink>
)

afterEach(() => {
Expand Down
1 change: 0 additions & 1 deletion src/components/Link/ChevronLink/ChevronLink.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,5 @@ ChevronLink.defaultProps = {
to: null,
href: null
}
ChevronLink.displayName = 'Link.Chevron'

export default ChevronLink
8 changes: 4 additions & 4 deletions src/components/Link/ChevronLink/ChevronLink.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ A Chevron Link is a navigational element that should only be used as a standalon
By default, Chevron Links will be displayed in the `primary` variant.

```
<Link.Chevron href="http://tds.telus.com">Go to Telus.com</Link.Chevron>
<ChevronLink href="http://tds.telus.com">Go to Telus.com</ChevronLink>
```

### Usage criteria
Expand All @@ -19,7 +19,7 @@ By default, Chevron Links will be displayed in the `primary` variant.
Specify the variant to create a button for secondary actions.

```
<Link.Chevron href="http://tds.telus.com" variant="secondary">Get great deals</Link.Chevron>
<ChevronLink href="http://tds.telus.com" variant="secondary">Get great deals</ChevronLink>
```

### Placing Chevron Links on solid colours
Expand All @@ -30,7 +30,7 @@ Use the inverted Chevron Link on top of the solid TELUS purple.
const PurpleBlock = require('../../__docs__/PurpleBlock').default;
<PurpleBlock>
<Link.Chevron href="http://tds.telus.com" variant="inverted">Find out how</Link.Chevron>
<ChevronLink href="http://tds.telus.com" variant="inverted">Find out how</ChevronLink>
</PurpleBlock>
```

Expand All @@ -39,5 +39,5 @@ const PurpleBlock = require('../../__docs__/PurpleBlock').default;
Chevron Link can be used as a "back" button by specifying the `direction`. These are not suitable for breadcrumb navigation due to the chevron's hover animation.

```
<Link.Chevron href="http://tds.telus.com" direction="left">Plans</Link.Chevron>
<ChevronLink href="http://tds.telus.com" direction="left">Plans</ChevronLink>
```
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ import React from 'react'
import { shallow } from 'enzyme'
import { warn } from '../../../../warn'

import Link from '../../Link'
import ChevronLink from '../ChevronLink'
import Icon from '../../../../old-components/Icon/Icon'

jest.mock('../../../../warn', () => (
{ warn: jest.fn() }
))

describe('Link.Chevron', () => {
describe('ChevronLink', () => {
const doShallow = (overrides = {}) => shallow(
<Link.Chevron {...overrides}>Go home</Link.Chevron>
<ChevronLink {...overrides}>Go home</ChevronLink>
)

afterEach(() => {
Expand Down
5 changes: 0 additions & 5 deletions src/components/Link/Link.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import React from 'react'
import PropTypes from 'prop-types'

import ChevronLink from './ChevronLink/ChevronLink'
import ButtonLink from './ButtonLink/ButtonLink'
import safeRest from '../../safeRest'
import { warn } from '../../warn'

Expand Down Expand Up @@ -68,7 +66,4 @@ Link.contextTypes = {
inheritColor: PropTypes.bool
}

Link.Chevron = ChevronLink

This comment has been minimized.

Copy link
@lzcabrera

lzcabrera Aug 29, 2017

Member

@ryanoglesby08 I think we will need to generate a v0.21.1 patch. Just realized we can't use and within starter kit because we got rid of line 71-72 aliases.

Link.Button = ButtonLink

export default Link

0 comments on commit 3a46497

Please sign in to comment.