Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ when possible and accept [props](https://facebook.github.io/react/docs/component
### Code Consistency

* All files and folders under `src/components` should name with PascalCase except `index.js` files
* If you need a constant file, it should be called `{Component_Name}Constants.js` (Component_Name with PascalCase)
* Each component should treat as a standalone package and live under its own folder
* Single file per component with **default export**
* When component is a set of components (e.g., ListGroup and ListGroupItem),
Expand Down
2 changes: 1 addition & 1 deletion src/components/Alert/Alert.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
ALERT_TYPES,
DEPRECATED_ALERT_TYPES,
ALERT_TYPE_ERROR
} from './constants';
} from './AlertConstants';

/**
* Alert Component for Patternfly React
Expand Down
2 changes: 1 addition & 1 deletion src/components/Alert/Alert.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { action } from '@storybook/addon-actions';
import { withKnobs, text, select } from '@storybook/addon-knobs';
import { defaultTemplate } from '../../../storybook/decorators/storyTemplates';
import { DOCUMENTATION_URL } from '../../../storybook/constants';
import { ALERT_TYPES } from './constants';
import { ALERT_TYPES } from './AlertConstants';
import { Alert } from './index';

const stories = storiesOf('Alert', module);
Expand Down
2 changes: 1 addition & 1 deletion src/components/Alert/Alert.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import React from 'react';
import renderer from 'react-test-renderer';
import Alert from './Alert';
import { ALERT_TYPES, DEPRECATED_ALERT_TYPES } from './constants';
import { ALERT_TYPES, DEPRECATED_ALERT_TYPES } from './AlertConstants';

const ALL_ALERT_TYPES = [...ALERT_TYPES, ...DEPRECATED_ALERT_TYPES];

Expand Down
2 changes: 1 addition & 1 deletion src/components/Alert/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
ALERT_TYPE_WARNING,
ALERT_TYPE_SUCCESS,
ALERT_TYPE_INFO
} from './constants';
} from './AlertConstants';

export const warnIfDeprecatedType = type => {
if (type === ALERT_TYPE_DANGER) {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Alert/helpers.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { warnIfDeprecatedType, getIconName, getClassName } from './helpers';
import { ALERT_TYPES, DEPRECATED_ALERT_TYPES } from './constants';
import { ALERT_TYPES, DEPRECATED_ALERT_TYPES } from './AlertConstants';

const ALL_ALERT_TYPES = [...ALERT_TYPES, ...DEPRECATED_ALERT_TYPES];

Expand Down
2 changes: 1 addition & 1 deletion src/components/Button/Button.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Button as BsButton } from 'react-bootstrap';
import React from 'react';
import PropTypes from 'prop-types';
import { BUTTON_BS_STYLES } from './constants';
import { BUTTON_BS_STYLES } from './ButtonConstants';

const Button = props => <BsButton {...props} />;

Expand Down
2 changes: 1 addition & 1 deletion src/components/Button/Button.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { inlineTemplate } from '../../../storybook/decorators/storyTemplates';
import { DOCUMENTATION_URL } from '../../../storybook/constants';
import { Grid, Row, Col, MenuItem } from '../../index';
import { Button, ButtonGroup, DropdownButton, SplitButton } from './index';
import { BUTTON_BS_STYLES } from './constants';
import { BUTTON_BS_STYLES } from './ButtonConstants';

const stories = storiesOf('Button', module);

Expand Down
2 changes: 1 addition & 1 deletion src/components/Button/DropdownButton.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import { DropdownButton as BsDropdownButton } from 'react-bootstrap';
import { BUTTON_BS_STYLES } from './constants';
import { BUTTON_BS_STYLES } from './ButtonConstants';

const DropdownButton = props => <BsDropdownButton {...props} />;

Expand Down
2 changes: 1 addition & 1 deletion src/components/Button/SplitButton.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import { SplitButton as BsSplitButton } from 'react-bootstrap';
import { BUTTON_BS_STYLES } from './constants';
import { BUTTON_BS_STYLES } from './ButtonConstants';

const SplitButton = props => <BsSplitButton {...props} />;

Expand Down
2 changes: 1 addition & 1 deletion src/components/Chart/AreaChart.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import C3Chart from 'react-c3js';
import { getComposer } from './constants';
import { getComposer } from './ChartConstants';

const AreaChart = getComposer('AREA_CHART')(
({ className, type, data, ...props }) => (
Expand Down
2 changes: 1 addition & 1 deletion src/components/Chart/BarChart.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import C3Chart from 'react-c3js';
import { getComposer } from './constants';
import { getComposer } from './ChartConstants';
import { compose, mapProps } from 'recompose';

import { c3ChartDefaults } from '../../common/patternfly';
Expand Down
2 changes: 1 addition & 1 deletion src/components/Chart/DonutChart.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { findDOMNode } from 'react-dom';
import { lifecycle, compose } from 'recompose';

import { patternfly } from '../../common/patternfly';
import { getComposer } from './constants';
import { getComposer } from './ChartConstants';

const pfSetDonutChartTitle = patternfly.pfSetDonutChartTitle;
const colIndexOfMaxValue = columns => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Chart/GroupedBarChart.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import C3Chart from 'react-c3js';
import { getComposer } from './constants';
import { getComposer } from './ChartConstants';

const GroupedBarChart = getComposer('GROUPED_BAR_CHART')(
({ className, type, data, ...props }) => (
Expand Down
2 changes: 1 addition & 1 deletion src/components/Chart/LineChart.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import C3Chart from 'react-c3js';
import { getComposer } from './constants';
import { getComposer } from './ChartConstants';

const LineChart = getComposer('LINE_CHART')(
({ className, type, data, ...props }) => (
Expand Down
2 changes: 1 addition & 1 deletion src/components/Chart/PieChart.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import C3Chart from 'react-c3js';
import { getComposer } from './constants';
import { getComposer } from './ChartConstants';

const PieChart = getComposer('PIE_CHART')(
({ className, type, data, ...props }) => (
Expand Down
2 changes: 1 addition & 1 deletion src/components/Chart/SingleAreaChart.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import C3Chart from 'react-c3js';
import { getComposer } from './constants';
import { getComposer } from './ChartConstants';

const SingleAreaChart = getComposer('SINGLE_AREA_CHART')(
({ className, type, data, ...props }) => (
Expand Down
2 changes: 1 addition & 1 deletion src/components/Chart/SingleLineChart.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import C3Chart from 'react-c3js';
import { getComposer } from './constants';
import { getComposer } from './ChartConstants';

const SingleLineChart = getComposer('SINGLE_LINE_CHART')(
({ className, type, data, ...props }) => (
Expand Down
2 changes: 1 addition & 1 deletion src/components/Chart/SparklineChart.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import C3Chart from 'react-c3js';
import { getComposer } from './constants';
import { getComposer } from './ChartConstants';

const SparklineChart = getComposer('SPARKLINE_CHART')(
({ className, type, data, ...props }) => (
Expand Down
2 changes: 1 addition & 1 deletion src/components/Chart/StackedBarChart.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import C3Chart from 'react-c3js';
import { getComposer } from './constants';
import { getComposer } from './ChartConstants';

const StackedBarChart = getComposer('STACKED_BAR_CHART')(
({ className, type, data, ...props }) => (
Expand Down
2 changes: 1 addition & 1 deletion src/components/Pagination/PaginationRow.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import PaginationRowItems from './PaginationRowItems';
import PaginationRowBack from './PaginationRowBack';
import PaginationRowForward from './PaginationRowForward';
import { noop } from '../../common/helpers';
import { PAGINATION_VIEW_TYPES, PAGINATION_VIEW } from './constants';
import { PAGINATION_VIEW_TYPES, PAGINATION_VIEW } from './PaginationConstants';
import { Form, FormControl, FormGroup, ControlLabel } from '../Form';
import { DropdownButton } from '../Button';
import { MenuItem } from '../MenuItem';
Expand Down
2 changes: 1 addition & 1 deletion src/components/Pagination/Paginator.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import PropTypes from 'prop-types';
import PaginationRow from './PaginationRow';
import { bindMethods, noop } from '../../common/helpers';
import { PAGINATION_VIEW_TYPES } from './constants';
import { PAGINATION_VIEW_TYPES } from './PaginationConstants';

class Paginator extends React.Component {
constructor(props) {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Pagination/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import paginate from './paginate';
import { PAGINATION_VIEW, PAGINATION_VIEW_TYPES } from './constants';
import { PAGINATION_VIEW, PAGINATION_VIEW_TYPES } from './PaginationConstants';
import Paginator from './Paginator';
import PaginationRow from './PaginationRow';
import PaginationRowAmountOfPages from './PaginationRowAmountOfPages';
Expand Down
2 changes: 1 addition & 1 deletion src/components/Table/TableCell.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import cx from 'classnames';
import { TABLE_ALIGN, TABLE_ALIGNMENT_TYPES } from './constants';
import { TABLE_ALIGN, TABLE_ALIGNMENT_TYPES } from './TableConstants';
/**
* TableCell component for Patternfly React
*/
Expand Down
2 changes: 1 addition & 1 deletion src/components/Table/TableHeading.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
TABLE_ALIGNMENT_TYPES,
TABLE_SORT_DIRECTION,
TABLE_SORT_DIRECTIONS
} from './constants';
} from './TableConstants';

/**
* TableHeading component for Patternfly React
Expand Down
2 changes: 1 addition & 1 deletion src/components/Table/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
TABLE_ALIGNMENT_TYPES,
TABLE_SORT_DIRECTION,
TABLE_SORT_DIRECTIONS
} from './constants';
} from './TableConstants';
import TableActions from './TableActions';
import TableButton from './TableButton';
import TableCell from './TableCell';
Expand Down
4 changes: 2 additions & 2 deletions src/components/VerticalNav/VerticalNav.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
addBodyEventListener,
removeBodyEventListener,
setBodyClassIf
} from './constants';
} from './VerticalNavConstants';
import VerticalNavSecondaryItem from './VerticalNavSecondaryItem';
import VerticalNavTertiaryItem from './VerticalNavTertiaryItem';

Expand Down Expand Up @@ -100,7 +100,7 @@ class BaseVerticalNav extends React.Component {

updateBodyClasses() {
// Note: Updating the body element classes from here like this is a hacky, non-react-y pattern.
// It's only here for consistency. See comments on getBodyContentElement in ./constants.js.
// It's only here for consistency. See comments on getBodyContentElement in ./VerticalNavConstants.js.
const {
dynamicBodyClasses,
navCollapsed,
Expand Down
6 changes: 5 additions & 1 deletion src/components/VerticalNav/VerticalNavItem.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import React from 'react';
import { getContext } from 'recompose';
import { wrongDepth, correctDepth, navContextTypes } from './constants';
import {
wrongDepth,
correctDepth,
navContextTypes
} from './VerticalNavConstants';
import VerticalNavItemHelper from './VerticalNavItemHelper';

/**
Expand Down
2 changes: 1 addition & 1 deletion src/components/VerticalNav/VerticalNavItemHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
getItemProps,
itemObjectTypes,
navContextTypes
} from './constants';
} from './VerticalNavConstants';

class BaseVerticalNavItemHelper extends React.Component {
constructor(props) {
Expand Down
2 changes: 1 addition & 1 deletion src/components/VerticalNav/VerticalNavMasthead.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
import { getContext } from 'recompose';
import { Navbar } from 'react-bootstrap';
import VerticalNavBrand from './VerticalNavBrand';
import { navContextTypes } from './constants';
import { navContextTypes } from './VerticalNavConstants';

/**
* VerticalNavMasthead - the first child of a VerticalNav component
Expand Down
6 changes: 5 additions & 1 deletion src/components/VerticalNav/VerticalNavSecondaryItem.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import React from 'react';
import { getContext } from 'recompose';
import { wrongDepth, correctDepth, navContextTypes } from './constants';
import {
wrongDepth,
correctDepth,
navContextTypes
} from './VerticalNavConstants';
import VerticalNavItemHelper from './VerticalNavItemHelper';

/**
Expand Down
6 changes: 5 additions & 1 deletion src/components/VerticalNav/VerticalNavTertiaryItem.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import React from 'react';
import { getContext } from 'recompose';
import { wrongDepth, correctDepth, navContextTypes } from './constants';
import {
wrongDepth,
correctDepth,
navContextTypes
} from './VerticalNavConstants';
import VerticalNavItemHelper from './VerticalNavItemHelper';

/**
Expand Down