Skip to content

Commit

Permalink
example-forum: Use vulcan-ui-bootstrap (partially implemented).
Browse files Browse the repository at this point in the history
Moving away of direct react-bootstrap dependency (issue VulcanJS#50).

Patch dos not include Dropdown and Modal refactoring yet.
  • Loading branch information
kabalin committed Apr 27, 2018
1 parent 8d1dd31 commit 1efb22c
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 20 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { ModalTrigger, Components, registerComponent, withList, Utils } from "meteor/vulcan:core";
import { Components, registerComponent, withList, Utils } from "meteor/vulcan:core";
import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import { FormattedMessage } from 'meteor/vulcan:i18n';
import Button from 'react-bootstrap/lib/Button';
import DropdownButton from 'react-bootstrap/lib/DropdownButton';
import MenuItem from 'react-bootstrap/lib/MenuItem';
import { withRouter } from 'react-router'
Expand Down Expand Up @@ -94,9 +93,9 @@ class CategoriesList extends PureComponent {
}
<Components.ShowIf check={Categories.options.mutations.new.check}>
<div className="categories-new-button category-menu-item dropdown-item">
<ModalTrigger title={<FormattedMessage id="categories.new"/>} component={<Button bsStyle="primary"><FormattedMessage id="categories.new"/></Button>}>
<Components.ModalTrigger title={<FormattedMessage id="categories.new"/>} component={<Components.Button variant="primary"><FormattedMessage id="categories.new"/></Components.Button>}>
<Components.CategoriesNewForm/>
</ModalTrigger>
</Components.ModalTrigger>
</div>
</Components.ShowIf>
</DropdownButton>
Expand Down
6 changes: 3 additions & 3 deletions packages/example-forum/lib/components/categories/Category.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ModalTrigger, Components, registerComponent } from 'meteor/vulcan:core';
import { Components, registerComponent } from 'meteor/vulcan:core';
import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import { LinkContainer } from 'react-router-bootstrap';
Expand All @@ -10,9 +10,9 @@ class Category extends PureComponent {

renderEdit() {
return (
<ModalTrigger title="Edit Category" component={<a className="edit-category-link"><Components.Icon name="edit"/></a>}>
<Components.ModalTrigger title="Edit Category" component={<a className="edit-category-link"><Components.Icon name="edit"/></a>}>
<Components.CategoriesEditForm category={this.props.category}/>
</ModalTrigger>
</Components.ModalTrigger>
)
}

Expand Down
3 changes: 1 addition & 2 deletions packages/example-forum/lib/components/common/Newsletter.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import PropTypes from 'prop-types';
import { FormattedMessage, intlShape } from 'meteor/vulcan:i18n';
import Formsy from 'formsy-react';
import { Input } from 'formsy-react-components';
import Button from 'react-bootstrap/lib/Button';
import Cookie from 'react-cookie';
import Users from 'meteor/vulcan:users';

Expand Down Expand Up @@ -80,7 +79,7 @@ class Newsletter extends PureComponent {
type="text"
layout="elementOnly"
/>
<Button className="newsletter-button" type="submit" bsStyle="primary"><FormattedMessage id="newsletter.subscribe"/></Button>
<Components.Button className="newsletter-button" type="submit" variant="primary"><FormattedMessage id="newsletter.subscribe"/></Components.Button>
</Formsy.Form>
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { Components, registerComponent, withMutation, withCurrentUser, withMessa
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { FormattedMessage, intlShape } from 'meteor/vulcan:i18n';
import Button from 'react-bootstrap/lib/Button';

class NewsletterButton extends Component {
constructor(props) {
Expand Down Expand Up @@ -37,13 +36,13 @@ class NewsletterButton extends Component {
render() {

return (
<Button
<Components.Button
className="newsletter-button"
onClick={this.subscriptionAction}
bsStyle="primary"
variant="primary"
>
<FormattedMessage id={this.props.label}/>
</Button>
</Components.Button>
)
}
}
Expand Down
6 changes: 3 additions & 3 deletions packages/example-forum/lib/components/posts/PostsItem.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Components, registerComponent, ModalTrigger } from 'meteor/vulcan:core';
import { Components, registerComponent } from 'meteor/vulcan:core';
import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import { FormattedMessage } from 'meteor/vulcan:i18n';
Expand All @@ -19,9 +19,9 @@ class PostsItem extends PureComponent {
renderActions() {
return (
<div className="posts-actions">
<ModalTrigger title="Edit Post" component={<a className="posts-action-edit"><FormattedMessage id="posts.edit"/></a>}>
<Components.ModalTrigger title="Edit Post" component={<a className="posts-action-edit"><FormattedMessage id="posts.edit"/></a>}>
<Components.PostsEditForm post={this.props.post} />
</ModalTrigger>
</Components.ModalTrigger>
</div>
)
}
Expand Down
3 changes: 1 addition & 2 deletions packages/example-forum/lib/components/posts/PostsList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@ import { Components, registerComponent, withList, withCurrentUser, Utils } from
import React from 'react';
import PropTypes from 'prop-types';
import { Posts } from '../../modules/posts/index.js';
import Alert from 'react-bootstrap/lib/Alert'
import { FormattedMessage, intlShape } from 'meteor/vulcan:i18n';
import classNames from 'classnames';

const Error = ({error}) => <Alert className="flash-message" bsStyle="danger"><FormattedMessage id={error.id} values={{value: error.value}}/>{error.message}</Alert>
const Error = ({error}) => <Components.Alert className="flash-message" variant="danger"><FormattedMessage id={error.id} values={{value: error.value}}/>{error.message}</Components.Alert>

const PostsList = ({className, results, loading, count, totalCount, loadMore, showHeader = true, showLoadMore = true, networkStatus, currentUser, error, terms}) => {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ import { Components, registerComponent, withCurrentUser } from 'meteor/vulcan:co
import React from 'react';
import PropTypes from 'prop-types';
import { FormattedMessage, intlShape } from 'meteor/vulcan:i18n';
import Button from 'react-bootstrap/lib/Button';

const PostsNewButton = (props, context) => {

const size = props.currentUser ? 'large' : 'small';
const button = <Button className="posts-new-button" bsStyle="primary"><Components.Icon name="new"/> <FormattedMessage id="posts.new_post"/></Button>;
const button = <Components.Button className="posts-new-button" variant="primary"><Components.Icon name="new"/> <FormattedMessage id="posts.new_post"/></Components.Button>;
return (
<Components.ModalTrigger size={size} title={context.intl.formatMessage({ id: 'posts.new_post' })} component={button}>
<Components.PostsNewForm />
Expand Down
1 change: 1 addition & 0 deletions packages/example-forum/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Package.onUse(function (api) {
'vulcan:[email protected]',

// vulcan packages
'vulcan:[email protected]',
'vulcan:[email protected]',
'vulcan:[email protected]',
'vulcan:[email protected]',
Expand Down

0 comments on commit 1efb22c

Please sign in to comment.