Skip to content
This repository has been archived by the owner on Apr 27, 2022. It is now read-only.

Commit

Permalink
Merge branch 'make-uncontrolled-the-default' into add-default-name-to…
Browse files Browse the repository at this point in the history
…-form-components
  • Loading branch information
Fernando Via Canel committed Nov 11, 2016
2 parents 07f012a + a4ba059 commit 9091995
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 28 deletions.
10 changes: 5 additions & 5 deletions Installments/example.jsx → BoxSelector/example.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import Installments from '../Installments'
import BoxSelector from '../BoxSelector'
import { LIVE_WIDE } from '../Showroom/variationTypes'

const options = [
Expand All @@ -10,15 +10,15 @@ const options = [
]

export default {
title: 'Installments',
title: 'BoxSelector',

examples: {
require: 'import Installments from \'@klarna/ui/Installments\'',
require: 'import BoxSelector from \'@klarna/ui/BoxSelector\'',
type: LIVE_WIDE,

examples: {
Regular: (
<Installments
<BoxSelector
onChange={(key) => console.log('You selected', key)}
name='installments'
defaultValue='installments_12'
Expand All @@ -27,7 +27,7 @@ export default {
),

Controlled: (
<Installments
<BoxSelector
onChange={(key) => console.log('You selected', key)}
value='installments_24'
focus='installments_6'
Expand Down
8 changes: 4 additions & 4 deletions Installments/index.jsx → BoxSelector/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
uniqueName
} from '@klarna/higher-order-components'

const baseClass = 'installments'
const baseClass = 'box-selector'
const TRANSITION_DURATION = 500

const classes = {
Expand Down Expand Up @@ -50,8 +50,8 @@ const calculateHighlightPosition = (selected) => {
}
}

const Installments = React.createClass({
displayName: 'Installments',
const BoxSelector = React.createClass({
displayName: 'BoxSelector',

propTypes: {
options: PropTypes.arrayOf(PropTypes.shape({
Expand Down Expand Up @@ -313,4 +313,4 @@ export default compose(
})),
overridable(defaultStyles),
uniqueName
)(Installments)
)(BoxSelector)
16 changes: 8 additions & 8 deletions Installments/styles.scss → BoxSelector/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
$transition-duration: 500ms;
$highlightTransitionEasing: cubic-bezier(.31,.09,.24,1);

.installments {
.box-selector {
border: ($grid * .2) solid $border-color;
border-radius: 5px;
box-sizing: border-box;
Expand All @@ -24,23 +24,23 @@ $highlightTransitionEasing: cubic-bezier(.31,.09,.24,1);
table-layout: fixed;
}

.installments__input {
.box-selector__input {
display: block;
height: 0;
opacity: 0;
position: absolute;
width: 0;
}

.installments__row {
.box-selector__row {
display: block;

@include respond-to-wide {
display: table-row;
}
}

.installments__cell {
.box-selector__cell {
-webkit-tap-highlight-color: rgba(0,0,0,0);
border-top: ($grid * .2) solid $border-color;
box-sizing: border-box;
Expand Down Expand Up @@ -76,7 +76,7 @@ $highlightTransitionEasing: cubic-bezier(.31,.09,.24,1);
}
}

.installments__cell__content {
.box-selector__cell__content {
@include typography(map-get($font-sizes, big-body-mobile), semi-bold);

-webkit-tap-highlight-color: rgba(0,0,0,0);
Expand All @@ -93,8 +93,8 @@ $highlightTransitionEasing: cubic-bezier(.31,.09,.24,1);
}
}

.installments__cell.is-hovered,
.installments__cell.is-focused {
.box-selector__cell.is-hovered,
.box-selector__cell.is-focused {
color: map-get($colors, klarna-blue);
}

Expand All @@ -106,7 +106,7 @@ $highlightTransitionEasing: cubic-bezier(.31,.09,.24,1);
}
}

.installments__cell__highlight {
.box-selector__cell__highlight {
border: ($grid * .4) solid map-get($colors, klarna-blue);
border-radius: 5px;
box-sizing: border-box;
Expand Down
4 changes: 2 additions & 2 deletions Radio/example.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Radio from '../Radio'
import * as Checklist from '../Checklist'
import * as Paragraph from '../Paragraph'
import { LIVE_WIDE } from '../Showroom/variationTypes'
import Installments from '../Installments'
import BoxSelector from '../BoxSelector'
import Dropdown from '../Dropdown'
import Subtitle from '../Subtitle'

Expand Down Expand Up @@ -37,7 +37,7 @@ const optionsWithContent = [
label: 'Sit',
description: 'Amet et consequetur',
content: <div>
<Installments
<BoxSelector
onChange={(key) => console.log('You selected', key)}
options={[{content: <div>Long one line text in div</div>, key: 'installments_3'}, {content: [<div key='1'>$64.17/mo.</div>, <div key='2'>array of elements</div>], key: 'installments_6'}]}
defaultValue='installments_6'
Expand Down
2 changes: 1 addition & 1 deletion Showroom/examples/components.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export Alert from '../../Alert/example'
export Block from '../../Block/example'
export BoxSelector from '../../BoxSelector/example'
export Button from '../../Button/example'
export Checklist from '../../Checklist/example'
export ContextMenu from '../../ContextMenu/example'
Expand All @@ -9,7 +10,6 @@ export Field from '../../Field/example'
export Fieldset from '../../Fieldset/example'
export Icons from '../../icons/example'
export Input from '../../Input/example'
export Installments from '../../Installments/example'
export Label from '../../Label/example'
export List from '../../List/example'
export Loader from '../../Loader/example'
Expand Down
6 changes: 3 additions & 3 deletions Showroom/examples/compositions/UncontrolledForm.jsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import React from 'react'
import BoxSelector from '../../../BoxSelector'
import Fieldset from '../../../Fieldset'
import Dropdown from '../../../Dropdown'
import Field from '../../../Field'
import * as Switch from '../../../Switch'
import * as Button from '../../../Button'
import * as Selector from '../../../Selector'
import * as Menu from '../../../Menu'
import Installments from '../../../Installments'
import Radio from '../../../Radio'
import Subtitle from '../../../Subtitle'
import * as Paragraph from '../../../Paragraph'
Expand Down Expand Up @@ -35,7 +35,7 @@ const optionsWithContent = [
label: 'Sit',
description: 'Amet et consequetur',
content: <div>
<Installments
<BoxSelector
onChange={(key) => console.log('You selected', key)}
options={[{content: <div>Long one line text in div</div>, key: 'installments_3'}, {content: [<div key='1'>$64.17/mo.</div>, <div key='2'>array of elements</div>], key: 'installments_6'}]}
value='installments_6'
Expand Down Expand Up @@ -148,7 +148,7 @@ export default {

<Fieldset margins>
<Subtitle>How many installments do you want to have?</Subtitle>
<Installments
<BoxSelector
name='installments'
options={[
{
Expand Down
8 changes: 4 additions & 4 deletions Theme/example.jsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import React from 'react'
import Fieldset from '../Fieldset'
import Theme from '../Theme'
import BoxSelector from '../BoxSelector'
import * as Button from '../Button'
import * as Checklist from '../Checklist'
import Dropdown from '../Dropdown'
import Field from '../Field'
import * as FieldVariant from '../Field'
import Installments from '../Installments'
import Link from '../Link'
import * as Switch from '../Switch'
import * as Title from '../Title'
Expand Down Expand Up @@ -39,7 +39,7 @@ const optionsWithContent = [
label: 'Sit',
description: 'Amet et consequetur',
content: <div>
<Installments
<BoxSelector
onChange={(key) => console.log('You selected', key)}
options={[{content: <div>Long one line text in div</div>, key: 'installments_3'}, {content: [<div key='1'>$64.17/mo.</div>, <div key='2'>array of elements</div>], key: 'installments_6'}]}
defaultValue='installments_6'
Expand Down Expand Up @@ -77,12 +77,12 @@ export default {

examples: {
require: `import Theme from '@klarna/ui/Theme'
import BoxSelector from '@klarna/ui/BoxSelector'
import * as Button from '@klarna/ui/Button'
import * as Checklist from '@klarna/ui/Checklist'
import Dropdown from '@klarna/ui/Dropdown'
import * as Field from '@klarna/ui/Field'
import Field from '@klarna/ui/Field'
import Installments from '@klarna/ui/Installments'
import Link from '@klarna/ui/Link'
import * as Switch from '@klarna/ui/Switch'
import * as Title from '@klarna/ui/Title'
Expand Down Expand Up @@ -191,7 +191,7 @@ import * as List from '@klarna/ui/List'`,
</Fieldset>

<div style={{paddingBottom: '20px'}}>
<Installments
<BoxSelector
onChange={(key) => console.log('You selected', key)}
defaultValue='installments_24'
options={[
Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as TheAlert from './Alert'
export { default as Amount } from './Amount'
import * as TheBlock from './Block'
export { default as BoxSelector } from './BoxSelector'
import * as TheButton from './Button'
import * as TheChecklist from './Checklist'
import * as TheContextMenu from './ContextMenu'
Expand All @@ -11,7 +12,6 @@ export { default as Fieldset } from './Fieldset'
import * as TheIconButton from './IconButton'
import * as TheIcons from './icons'
export { default as Input } from './Input'
export { default as Installments } from './Installments'
export { default as Label } from './Label'
export { default as Link } from './Link'
export { default as Loader } from './Loader'
Expand Down

0 comments on commit 9091995

Please sign in to comment.