Skip to content

Commit

Permalink
[ MERGE ] from dev
Browse files Browse the repository at this point in the history
  • Loading branch information
grovertb committed Feb 18, 2020
2 parents cd702c9 + ca84e03 commit 683879b
Show file tree
Hide file tree
Showing 57 changed files with 1,450 additions and 320 deletions.
3 changes: 1 addition & 2 deletions docs/src/components/MarkDowns/DemoSandboxed.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import React from 'react'
import PropTypes from 'prop-types'
import { create } from 'jss'
import { withStyles, useTheme, jssPreset, StylesProvider } from '@krowdy-ui/core/styles'
import Frame from 'react-frame-component'
import { CssGlobal } from '@krowdy-ui/core'
import { withStyles, useTheme, jssPreset, StylesProvider, CssGlobal } from '@krowdy-ui/core'

const styles = theme => ({
frame: {
Expand Down
21 changes: 16 additions & 5 deletions docs/src/components/MarkDowns/getDemoConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,16 @@ function jsDemo(demoData) {
'index.js': `
import React from 'react';
import ReactDOM from 'react-dom';
import { ThemeProvider, createMuiTheme, krowdyTheme } from "@krowdy-ui/core";
import Demo from './demo';
ReactDOM.render(<Demo />, document.querySelector('#root'));
`
}
ReactDOM.render(
<ThemeProvider theme={createMuiTheme(krowdyTheme)}>
<Demo />
</ThemeProvider>,
document.querySelector('#root')
);
` }
}
}

Expand All @@ -24,10 +29,16 @@ function tsDemo(demoData) {
'index.tsx': `
import React from 'react';
import ReactDOM from 'react-dom';
import { ThemeProvider, createMuiTheme, krowdyTheme } from "@krowdy-ui/core";
import Demo from './demo';
ReactDOM.render(<Demo />, document.querySelector('#root'));
`,
ReactDOM.render(
<ThemeProvider theme={createMuiTheme(krowdyTheme)}>
<Demo />
</ThemeProvider>,
document.querySelector('#root')
);
`,
'tsconfig.json': `{
"compilerOptions": {
"target": "es5",
Expand Down
36 changes: 36 additions & 0 deletions docs/src/containers/components/notify/notify.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import React from 'react'
import { makeStyles } from '@krowdy-ui/core/styles'
import { notify } from '@krowdy-ui/core'

const useStyles = makeStyles(theme => ({
root: {
backgroundColor: theme.palette.background.paper,
flexGrow : 1
}
}))

export default function SimpleTabs() {
const classes = useStyles()

const _handleClickSuccess = () => {
notify.success('!Notify!', { time: 5000 })
}

const _handleClickWarning = () => {
notify.warning('!Notify!', { time: 5000 })
}

const _handleClickError = () => {
notify.error('!Notify!', { time: 5000 })
}

return (
<div className={classes.root}>
<button onClick={_handleClickSuccess}>Notify Success</button>
<br />
<button onClick={_handleClickWarning}>Notify Warning</button>
<br />
<button onClick={_handleClickError}>Notify Error</button>
</div>
)
}
7 changes: 7 additions & 0 deletions docs/src/containers/components/notify/notify.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Notify

<p class="description">View Notify.</p>

## Notify Example

{{"demo": "containers/components/notify/notify.js", "bg": true}}
36 changes: 36 additions & 0 deletions docs/src/containers/components/notify/notify.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import React from 'react'
import { makeStyles } from '@krowdy-ui/core/styles'
import { notify } from '@krowdy-ui/core'

const useStyles = makeStyles(theme => ({
root: {
backgroundColor: theme.palette.background.paper,
flexGrow : 1
}
}))

export default function SimpleTabs() {
const classes = useStyles()

const _handleClickSuccess = () => {
notify.success('!Notify!', { time: 5000 })
}

const _handleClickWarning = () => {
notify.warning('!Notify!', { time: 5000 })
}

const _handleClickError = () => {
notify.error('!Notify!', { time: 5000 })
}

return (
<div className={classes.root}>
<button onClick={_handleClickSuccess}>Notify Success</button>
<br />
<button onClick={_handleClickWarning}>Notify Warning</button>
<br />
<button onClick={_handleClickError}>Notify Error</button>
</div>
)
}
1 change: 1 addition & 0 deletions docs/src/containers/views/cardcandidate/CardCandidate.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export default function () {
<CardCandidate
_id={1}
checked={checked}
colorCheckbox='krowdy'
firstName={firstName}
lastName={lastName}
onChangeCheckbox={_handleChange}
Expand Down
46 changes: 32 additions & 14 deletions docs/src/containers/views/counter/Counter.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
import React from 'react'
import React, { useState } from 'react'
import { Counter } from '@krowdy-ui/views'
import AddIcon from '@material-ui/icons/Add'
import RemoveIcon from '@material-ui/icons/Remove'

export default function () {
const initialCounterValue = 10
const disabled = false
const min = 5
const max = 15
const [ number, setNumber ] = React.useState(initialCounterValue)
const [ countersState, setCountersState ] = useState({
first : 5,
second: 30
})

const onChange = (event) => {
setNumber(event)
const changeCounterState = (values) => {
setCountersState(prev => ({
...prev,
...values
}))
}

const _handleChange = (event) => {
changeCounterState({
[event.target.name]: event.target.value
})
}

return (
Expand All @@ -26,12 +34,22 @@ export default function () {
}}>
<Counter
addIcon={<AddIcon style={{ height: 18, width: 18 }} />}
disabled={disabled}
max={max}
min={min}
number={number}
onChange={onChange}
removeIcon={<RemoveIcon style={{ height: 18, width: 18 }} />} />
max={10}
min={5}
name='first'
number={countersState.first}
onChange={_handleChange}
removeIcon={<RemoveIcon style={{ height: 18, width: 18 }} />}
width={{ width: 40 }} />
<Counter
addIcon={<AddIcon style={{ height: 18, width: 18 }} />}
max={1000}
min={25}
name='second'
number={countersState.second}
onChange={_handleChange}
removeIcon={<RemoveIcon style={{ height: 18, width: 18 }} />}
width={{ width: 40 }} />
</div>

)
Expand Down
4 changes: 2 additions & 2 deletions docs/src/containers/views/counter/counter.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
| name | string | | The name attribute specifies the name of an input element. |
| max | number | | Maximum limit of the counter. |
| min | number | | Minimum counter limit. |
| name | string | | The name attribute specifies the name of an input element. |
| number | number | | is the number that increases and decreases. |
| onChange | function | | Callback fired when the state is changed. |
| onChange | func | | Callback fired when the state is changed.<br/><br> **Signature:** <br/>`function(event: { target: { name: string, value: number }}) => void` |
| removeIcon | icon | | ```<RemoveIcon/>``` Icon (-) |


44 changes: 44 additions & 0 deletions docs/src/containers/views/radioLabelGroup/RadioLabelGroup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import React, { useState } from 'react'
import { RadioLabelGroup } from '@krowdy-ui/views'

const items = [
{
label: 'Female',
value: 'female'
},
{
label: 'Male',
value: 'male'
},
{
label: 'Other',
value: 'other'
}
]

export default function () {
const [ value, setValue ] = useState('male')

const _handleChange = event => {
setValue(event.target.value)
}

return (
<div style={{
alignItems : 'center',
display : 'flex',
flexDirection : 'column',
height : 400,
justifyContent: 'space-evenly',
margin : 50,
width : 'auto'
}}>
<RadioLabelGroup
isRow
items={items}
name='Gender'
onChange={_handleChange}
value={value} />
</div>
)
}
10 changes: 10 additions & 0 deletions docs/src/containers/views/radioLabelGroup/RadioLabelGroup.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { RadioLabelGroup } from '@krowdy-ui/views'
import React from 'react'

export default function () {
return (
<div>
<RadioLabelGroup items={[]} />
</div>
)
}
21 changes: 21 additions & 0 deletions docs/src/containers/views/radioLabelGroup/radioLabelGroup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# RadioLabelGroup

<p class="description">Radio Group with labels</p>

{{"demo": "containers/views/radioLabelGroup/RadioLabelGroup.js"}}

<h1>
Props:
</h1>

| Name | Type | Default | Description |
|:------------------------------------|:---------------------|:---------|:-------------|
| classes | object | | |
| isRow | bool | | Define if items are listed in horizontal mode |
| name | string | | The name used to reference the value of the control. |
| onChange | func | | |
| value | any | | Value of the selected radio button. |
| items | `{ label: string, value: any }[]` | [] | Items list |
| | | | |


Loading

0 comments on commit 683879b

Please sign in to comment.