Skip to content

Commit

Permalink
DIG-11112 - Styling nytt søknadsskjema kredittkort.
Browse files Browse the repository at this point in the history
Lagt til mulighet til å stilsette ytre container div vha prop containerClassName.
  • Loading branch information
Roger Andreassen committed Oct 4, 2016
1 parent 9c0165e commit 559046e
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 2.4.0

* Added added support for css styling of container-div, using prop containerClassName

## 2.3.0

* Added onBlur support
Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,16 @@ Passing `invalid` to the `Dropdown` will give a red color on the element.
</Dropdown>
```
If you need to add styling to the outer div-container of the component and pass the attribute containerClassName.
The containerClassName will be appended to the default class 'ffe-input-group'.
```javascript
<label for={ uniqueIdString }>{ labelTextString }</label>
<Dropdown containerClassName={ myContainterClass }>
<option value="val1">Option text</option>
</Dropdown>
```
### Loading state
Loading state can be indicated using `isLoading`. When this is set a loading spinner will be rendered next to the dropdown.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ffe-dropdown-react",
"version": "2.3.0",
"version": "2.4.0",
"main": "lib/dropdown.js",
"scripts": {
"build": "babel -d lib/. --ignore=*.test.js src/. && npm run example",
Expand Down
5 changes: 3 additions & 2 deletions src/dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const createID = (label, options) => {
function Dropdown({
id,
className = '',
containerClassName = '',
label,
onChange,
onBlur,
Expand All @@ -22,14 +23,14 @@ function Dropdown({
}) {
const domId = id || createID(label, children);

return <div className="ffe-input-group" aria-live="polite">
return <div className={ `ffe-input-group ${containerClassName}` } aria-live="polite">
{ label &&
<label className="ffe-form-label" htmlFor={ domId }>
{ label }
</label>
}
<select
className={`ffe-dropdown ${className}`}
className={ `ffe-dropdown ${className}` }
id={ domId }
onChange={ onChange }
onBlur={ onBlur }
Expand Down

0 comments on commit 559046e

Please sign in to comment.