Skip to content

Commit

Permalink
fix(admin-ui): es lint run
Browse files Browse the repository at this point in the history
  • Loading branch information
mjatin-dev committed Nov 14, 2022
1 parent f3ae09f commit 5ac7600
Show file tree
Hide file tree
Showing 50 changed files with 1,529 additions and 1,529 deletions.
94 changes: 47 additions & 47 deletions admin-ui/app/components/Accordion/Accordion.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,57 +6,57 @@ import Card from './../Card'
import { Provider } from './context'

export class Accordion extends React.Component {
static propTypes = {
initialOpen: PropTypes.bool,
onToggle: PropTypes.func,
open: PropTypes.bool,
children: PropTypes.node,
className: PropTypes.string
};

constructor(props) {
super(props)

this.state = {
isOpen: props.initialOpen
}

if (props.open !== 'undefined' && props.onToggle === 'undefined') {
throw new Error("Accordion: props.open has to be used combined with props.onToggle " +
"use props.initialOpen to create an uncontrolled Accordion.")
}
static propTypes = {
initialOpen: PropTypes.bool,
onToggle: PropTypes.func,
open: PropTypes.bool,
children: PropTypes.node,
className: PropTypes.string
}

constructor(props) {
super(props)

this.state = {
isOpen: props.initialOpen
}

toggleHandler() {
const { onToggle } = this.props

if (!onToggle) {
this.setState({ isOpen: !this.state.isOpen })
} else {
this.onToggle(!this.props.open)
}
if (props.open !== 'undefined' && props.onToggle === 'undefined') {
throw new Error("Accordion: props.open has to be used combined with props.onToggle " +
"use props.initialOpen to create an uncontrolled Accordion.")
}
}

isOpen() {
return !this.props.onToggle ?
this.state.isOpen : this.props.open
}
toggleHandler() {
const { onToggle } = this.props

render() {
/* eslint-disable-next-line no-unused-vars */
const { className, children, initialOpen, ...otherProps } = this.props

return (
<Provider
value={{
onToggle: this.toggleHandler.bind(this),
isOpen: this.isOpen()
}}
>
<Card className={ className } { ...otherProps }>
{ children }
</Card>
</Provider>
)
if (!onToggle) {
this.setState({ isOpen: !this.state.isOpen })
} else {
this.onToggle(!this.props.open)
}
}

isOpen() {
return !this.props.onToggle ?
this.state.isOpen : this.props.open
}

render() {
/* eslint-disable-next-line no-unused-vars */
const { className, children, initialOpen, ...otherProps } = this.props

return (
<Provider
value={{
onToggle: this.toggleHandler.bind(this),
isOpen: this.isOpen()
}}
>
<Card className={ className } { ...otherProps }>
{ children }
</Card>
</Provider>
)
}
}
36 changes: 18 additions & 18 deletions admin-ui/app/components/Avatar/Avatar.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,24 +33,24 @@ const Avatar = (props) => {
{
!isEmpty(icons) && (() => {
switch(icons.length) {
case 1:
return (
<div className="avatar__icon">
{ first(icons) }
</div>
)
default:
return (
<div
className={
classNames({
'avatar__icon--nested': isNested,
}, 'avatar__icon', 'avatar__icon--stack')
}
>
{ icons }
</div>
)
case 1:
return (
<div className="avatar__icon">
{ first(icons) }
</div>
)
default:
return (
<div
className={
classNames({
'avatar__icon--nested': isNested,
}, 'avatar__icon', 'avatar__icon--stack')
}
>
{ icons }
</div>
)
}
})()
}
Expand Down
78 changes: 39 additions & 39 deletions admin-ui/app/components/Avatar/AvatarImage.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,51 +7,51 @@ import { Avatar } from './Avatar'
import { AvatarFont } from './AvatarFont'

class AvatarImage extends React.PureComponent {
static propTypes = {
src: PropTypes.string.isRequired,
placeholder: PropTypes.node,
alt: PropTypes.string,
className: PropTypes.string,
...omit(Avatar.propTypes, ['children'])
};
static propTypes = {
src: PropTypes.string.isRequired,
placeholder: PropTypes.node,
alt: PropTypes.string,
className: PropTypes.string,
...omit(Avatar.propTypes, ['children'])
}

static defaultProps = {
placeholder: <i className="fa fa-user fa-fw"></i>
}
static defaultProps = {
placeholder: <i className="fa fa-user fa-fw"></i>
}

constructor(props) {
super(props)
constructor(props) {
super(props)

this.state = {
imgLoaded: false
}
this.state = {
imgLoaded: false
}
}

render() {
const { src, placeholder, alt, className, ...avatarProps } = this.props
const parentClass = classNames('avatar-image', {
'avatar-image--loaded': this.state.imgLoaded
}, className)
render() {
const { src, placeholder, alt, className, ...avatarProps } = this.props
const parentClass = classNames('avatar-image', {
'avatar-image--loaded': this.state.imgLoaded
}, className)

return (
<div className={ parentClass }>
<Avatar className="avatar-image__image" {...avatarProps}>
<img
src={ src }
alt={ alt }
onLoad={ () => { this.setState({ imgLoaded: true }) } }
/>
</Avatar>
{
!this.state.imgLoaded && (
<AvatarFont className="avatar-image__placeholder" {...avatarProps}>
{ placeholder }
</AvatarFont>
)
}
</div>
)
}
return (
<div className={ parentClass }>
<Avatar className="avatar-image__image" {...avatarProps}>
<img
src={ src }
alt={ alt }
onLoad={ () => { this.setState({ imgLoaded: true }) } }
/>
</Avatar>
{
!this.state.imgLoaded && (
<AvatarFont className="avatar-image__placeholder" {...avatarProps}>
{ placeholder }
</AvatarFont>
)
}
</div>
)
}
}

export { AvatarImage }
2 changes: 1 addition & 1 deletion admin-ui/app/components/EmptyLayout/EmptyLayout.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class EmptyLayout extends React.Component {
pageConfig: PropTypes.object.isRequired,
children: PropTypes.node.isRequired,
className: PropTypes.string
};
}

componentDidMount() {
this.props.pageConfig.setElementsVisibility({
Expand Down
100 changes: 50 additions & 50 deletions admin-ui/app/components/FloatGrid/Col.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,62 +28,62 @@ const getCurrentbreakPoint = (width, breakPoints) => {
}

export class Col extends React.Component {
static propTypes = {
active: PropTypes.bool,
static propTypes = {
active: PropTypes.bool,

lg: PropTypes.number,
md: PropTypes.number,
sm: PropTypes.number,
xs: PropTypes.number,
xl: PropTypes.number,
lg: PropTypes.number,
md: PropTypes.number,
sm: PropTypes.number,
xs: PropTypes.number,
xl: PropTypes.number,

xlH: PropTypes.number,
lgH: PropTypes.number,
mdH: PropTypes.number,
smH: PropTypes.number,
xsH: PropTypes.number,
xlH: PropTypes.number,
lgH: PropTypes.number,
mdH: PropTypes.number,
smH: PropTypes.number,
xsH: PropTypes.number,

xlX: PropTypes.number,
lgX: PropTypes.number,
mdX: PropTypes.number,
smX: PropTypes.number,
xsX: PropTypes.number,
xlX: PropTypes.number,
lgX: PropTypes.number,
mdX: PropTypes.number,
smX: PropTypes.number,
xsX: PropTypes.number,

xlY: PropTypes.number,
lgY: PropTypes.number,
mdY: PropTypes.number,
smY: PropTypes.number,
xsY: PropTypes.number,
xlY: PropTypes.number,
lgY: PropTypes.number,
mdY: PropTypes.number,
smY: PropTypes.number,
xsY: PropTypes.number,

trueSize: PropTypes.object,
children: PropTypes.node,
className: PropTypes.string
}
trueSize: PropTypes.object,
children: PropTypes.node,
className: PropTypes.string
}

static defaultProps = {
active: true
}
static defaultProps = {
active: true
}

render() {
const { active, children, className, trueSize } = this.props
const bsColumnProps = pick(this.props, ['xl', 'lg', 'md', 'sm', 'xs'])
const otherProps = omit(this.props, [...keys(Col.propTypes),
'minW', 'maxW', 'minH', 'maxH', 'moved', 'static', 'isDraggable', 'isResizable'])
const floatColBpId = trueSize ? getCurrentbreakPoint(trueSize.wPx, breakPoints) : 'xl'
const floatColClasses = classNames(className, 'float-col',
'float-column', `float-column--size-${floatColBpId}`)
render() {
const { active, children, className, trueSize } = this.props
const bsColumnProps = pick(this.props, ['xl', 'lg', 'md', 'sm', 'xs'])
const otherProps = omit(this.props, [...keys(Col.propTypes),
'minW', 'maxW', 'minH', 'maxH', 'moved', 'static', 'isDraggable', 'isResizable'])
const floatColBpId = trueSize ? getCurrentbreakPoint(trueSize.wPx, breakPoints) : 'xl'
const floatColClasses = classNames(className, 'float-col',
'float-column', `float-column--size-${floatColBpId}`)

return active ? (
<div { ...otherProps } className={ floatColClasses }>
{ children }
</div>
) : (
<BootstrapCol
{ ...(extend(bsColumnProps, otherProps)) }
className={ classNames(className, 'pb-3') }
>
{ children }
</BootstrapCol>
)
}
return active ? (
<div { ...otherProps } className={ floatColClasses }>
{ children }
</div>
) : (
<BootstrapCol
{ ...(extend(bsColumnProps, otherProps)) }
className={ classNames(className, 'pb-3') }
>
{ children }
</BootstrapCol>
)
}
}
Loading

0 comments on commit 5ac7600

Please sign in to comment.