Skip to content

Commit 9abff06

Browse files
adamkudrnabedrich-schindler
authored andcommitted
Exclude documentation components from library to decrease bundle build size (#32)
1 parent 0107caa commit 9abff06

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+168
-606
lines changed

demo/generated/demo.js

Lines changed: 0 additions & 30 deletions
This file was deleted.

dist/lib.js

Lines changed: 0 additions & 14 deletions
This file was deleted.

src/lib/components/documentation/Documentation/Documentation.scss renamed to src/demo/components/Documentation/Documentation.scss

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
@import '../../../styles/settings/colors';
2-
@import '../../../styles/settings/typography';
3-
@import '../../../styles/tools/offset';
1+
@import '../../../lib/styles/settings/colors';
2+
@import '../../../lib/styles/settings/typography';
3+
@import '../../../lib/styles/tools/offset';
44

55
.root {
66
margin-bottom: offset(7);
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// eslint-disable-next-line import/prefer-default-export
2+
export { default as Documentation } from './Documentation';
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
import PropTypes from 'prop-types';
22
import React from 'react';
3-
import styles from './DocumentationLayout.scss';
3+
import styles from './Layout.scss';
44

5-
const DocumentationLayout = (props) => (
5+
const Layout = (props) => (
66
<div className={styles.root}>
77
{props.children}
88
</div>
99
);
1010

11-
DocumentationLayout.defaultProps = {
11+
Layout.defaultProps = {
1212
children: null,
1313
};
1414

15-
DocumentationLayout.propTypes = {
15+
Layout.propTypes = {
1616
children: PropTypes.oneOfType([
1717
PropTypes.element,
1818
PropTypes.arrayOf(PropTypes.element),
1919
]),
2020
};
2121

22-
export default DocumentationLayout;
22+
export default Layout;
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
@import '../../../styles/settings/colors';
2-
@import '../../../styles/tools/breakpoints';
3-
@import '../../../styles/tools/offset';
1+
@import '../../../lib/styles/settings/colors';
2+
@import '../../../lib/styles/tools/breakpoints';
3+
@import '../../../lib/styles/tools/offset';
44

55
.content {
66
padding: offset(5);
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
import PropTypes from 'prop-types';
22
import React from 'react';
3-
import styles from './DocumentationLayout.scss';
3+
import styles from './Layout.scss';
44

5-
const DocumentationLayoutContent = (props) => (
5+
const LayoutContent = (props) => (
66
<main className={styles.content}>
77
{props.children}
88
</main>
99
);
1010

11-
DocumentationLayoutContent.defaultProps = {
11+
LayoutContent.defaultProps = {
1212
children: null,
1313
};
1414

15-
DocumentationLayoutContent.propTypes = {
15+
LayoutContent.propTypes = {
1616
children: PropTypes.oneOfType([
1717
PropTypes.element,
1818
PropTypes.arrayOf(PropTypes.element),
1919
]),
2020
};
2121

22-
export default DocumentationLayoutContent;
22+
export default LayoutContent;
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
import PropTypes from 'prop-types';
22
import React from 'react';
3-
import styles from './DocumentationLayout.scss';
3+
import styles from './Layout.scss';
44

5-
const DocumentationLayoutSidebar = (props) => (
5+
const LayoutSidebar = (props) => (
66
<aside className={styles.sidebar}>
77
{props.children}
88
</aside>
99
);
1010

11-
DocumentationLayoutSidebar.defaultProps = {
11+
LayoutSidebar.defaultProps = {
1212
children: null,
1313
};
1414

15-
DocumentationLayoutSidebar.propTypes = {
15+
LayoutSidebar.propTypes = {
1616
children: PropTypes.oneOfType([
1717
PropTypes.element,
1818
PropTypes.arrayOf(PropTypes.element),
1919
]),
2020
};
2121

22-
export default DocumentationLayoutSidebar;
22+
export default LayoutSidebar;

src/demo/components/Layout/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export { default as Layout } from './Layout';
2+
export { default as LayoutContent } from './LayoutContent';
3+
export { default as LayoutSidebar } from './LayoutSidebar';
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import PropTypes from 'prop-types';
22
import React from 'react';
3-
import styles from './DocumentationNavigation.scss';
3+
import styles from './Navigation.scss';
44

5-
const DocumentationNavigation = (props) => (
5+
const Navigation = (props) => (
66
<div>
77
<h1 className={styles.headline}>React UI</h1>
88
<ul className={styles.root}>
@@ -26,7 +26,7 @@ const DocumentationNavigation = (props) => (
2626
</div>
2727
);
2828

29-
DocumentationNavigation.propTypes = {
29+
Navigation.propTypes = {
3030
items: PropTypes.arrayOf(PropTypes.shape({
3131
items: PropTypes.arrayOf(PropTypes.shape({
3232
link: PropTypes.string.isRequired,
@@ -37,4 +37,4 @@ DocumentationNavigation.propTypes = {
3737
})).isRequired,
3838
};
3939

40-
export default DocumentationNavigation;
40+
export default Navigation;
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
@import '../../../styles/settings/colors';
2-
@import '../../../styles/settings/typography';
3-
@import '../../../styles/tools/offset';
4-
@import '../../../styles/tools/transitions';
1+
@import '../../../lib/styles/settings/colors';
2+
@import '../../../lib/styles/settings/typography';
3+
@import '../../../lib/styles/tools/offset';
4+
@import '../../../lib/styles/tools/transitions';
55

66
.headline {
77
padding: offset(6) offset(5) offset(2);
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// eslint-disable-next-line import/prefer-default-export
2+
export { default as Navigation } from './Navigation';
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import PropTypes from 'prop-types';
22
import React from 'react';
3-
import styles from './DocumentationPlaceholder.scss';
3+
import styles from './Placeholder.scss';
44

55
const DocumentationPlaceholder = (props) => (
66
<div className={styles.root}>
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
@import '../../../styles/settings/colors';
2-
@import '../../../styles/tools/offset';
1+
@import '../../../lib/styles/settings/colors';
2+
@import '../../../lib/styles/tools/offset';
33

44
.root {
55
padding: offset(3);
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// eslint-disable-next-line import/prefer-default-export
2+
export { default as Placeholder } from './Placeholder';
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import PropTypes from 'prop-types';
22
import React from 'react';
3-
import styles from './DocumentationSwatch.scss';
3+
import styles from './Swatch.scss';
44

5-
const DocumentationSwatch = (props) => {
5+
const Swatch = (props) => {
66
const style = {
77
backgroundColor: `var(--rui-color-${props.color})`,
88
};
@@ -17,8 +17,8 @@ const DocumentationSwatch = (props) => {
1717
);
1818
};
1919

20-
DocumentationSwatch.propTypes = {
20+
Swatch.propTypes = {
2121
color: PropTypes.string.isRequired,
2222
};
2323

24-
export default DocumentationSwatch;
24+
export default Swatch;
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
@import '../../../styles/settings/typography';
2-
@import '../../../styles/tools/offset';
1+
@import '../../../lib/styles/settings/typography';
2+
@import '../../../lib/styles/tools/offset';
33

44
.root {
55
display: inline-block;

src/demo/components/Swatch/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// eslint-disable-next-line import/prefer-default-export
2+
export { default as Swatch } from './Swatch';

src/demo/components/index.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
export { Documentation } from './Documentation';
2+
export { Icon } from './Icon';
3+
export {
4+
Layout,
5+
LayoutContent,
6+
LayoutSidebar,
7+
} from './Layout';
8+
export { Navigation } from './Navigation';
9+
export { Placeholder } from './Placeholder';
10+
export { Swatch } from './Swatch';

0 commit comments

Comments
 (0)