@expandorg/components
Advanced tools
Comparing version 0.2.87 to 0.2.88
@@ -58,2 +58,3 @@ // @flow | ||
import useHotkey from './src/components/hooks/useHotkey'; | ||
import useDocumentTitle from './src/components/hooks/useDocumentTitle'; | ||
@@ -115,2 +116,3 @@ import deferVisibleRender from './src/components/hoc/deferVisibleRender'; | ||
useHotkey, | ||
useDocumentTitle, | ||
deferVisibleRender, | ||
@@ -117,0 +119,0 @@ deferComponentRender, |
{ | ||
"name": "@expandorg/components", | ||
"version": "0.2.87", | ||
"version": "0.2.88", | ||
"description": "expand UI components library", | ||
@@ -35,3 +35,3 @@ "main": "index.js", | ||
}, | ||
"gitHead": "720b213a4f99279629073f1fe9869b892a87a10d" | ||
"gitHead": "e1f0ee4a09658f96fd18b3822fc6c73faa51b27e" | ||
} |
@@ -1,45 +0,40 @@ | ||
import React, { Component } from 'react'; | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import cn from 'classnames'; | ||
import DocumentTitle from 'react-document-title'; | ||
import useDocumentTitle from '../../hooks/useDocumentTitle'; | ||
import './Page.styl'; | ||
export default class Page extends Component { | ||
static propTypes = { | ||
title: PropTypes.string.isRequired, | ||
className: PropTypes.string, | ||
sidebar: PropTypes.bool, | ||
navbar: PropTypes.bool, | ||
}; | ||
export default function Page({ children, title, className, sidebar, navbar }) { | ||
useDocumentTitle(`${title} - Expand`); | ||
return ( | ||
<div className="gem-page"> | ||
<div | ||
className={cn( | ||
'gem-content', | ||
{ | ||
'gem-content__sidebar': sidebar, | ||
'gem-content__navbar': navbar, | ||
}, | ||
className | ||
)} | ||
> | ||
{children} | ||
</div> | ||
</div> | ||
); | ||
} | ||
static defaultProps = { | ||
className: null, | ||
sidebar: true, | ||
navbar: true, | ||
}; | ||
Page.propTypes = { | ||
title: PropTypes.string.isRequired, | ||
className: PropTypes.string, | ||
sidebar: PropTypes.bool, | ||
navbar: PropTypes.bool, | ||
}; | ||
render() { | ||
const { children, title, className, sidebar, navbar } = this.props; | ||
return ( | ||
<DocumentTitle title={`${title} - Expand`}> | ||
<div className="gem-page"> | ||
<div | ||
className={cn( | ||
'gem-content', | ||
{ | ||
'gem-content__sidebar': sidebar, | ||
'gem-content__navbar': navbar, | ||
}, | ||
className | ||
)} | ||
> | ||
{children} | ||
</div> | ||
</div> | ||
</DocumentTitle> | ||
); | ||
} | ||
} | ||
Page.defaultProps = { | ||
className: null, | ||
sidebar: true, | ||
navbar: true, | ||
}; |
@@ -1,28 +0,21 @@ | ||
import React, { Component } from 'react'; | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import cn from 'classnames'; | ||
import DocumentTitle from 'react-document-title'; | ||
import useDocumentTitle from '../../hooks/useDocumentTitle'; | ||
import './PageDark.styl'; | ||
export default class PageDark extends Component { | ||
static propTypes = { | ||
title: PropTypes.string.isRequired, | ||
className: PropTypes.string, | ||
}; | ||
export default function PageDark({ children, title, className }) { | ||
useDocumentTitle(title); | ||
return <div className={cn('gem-pagedark', className)}>{children}</div>; | ||
} | ||
static defaultProps = { | ||
className: null, | ||
}; | ||
PageDark.propTypes = { | ||
title: PropTypes.string.isRequired, | ||
className: PropTypes.string, | ||
}; | ||
render() { | ||
const { children, title, className } = this.props; | ||
return ( | ||
<DocumentTitle title={title}> | ||
<div className={cn('gem-pagedark', className)}>{children}</div> | ||
</DocumentTitle> | ||
); | ||
} | ||
} | ||
PageDark.defaultProps = { | ||
className: null, | ||
}; |
202966
207
3923