GithubHelp home page GithubHelp logo

couds / react-bulma-components Goto Github PK

View Code? Open in Web Editor NEW
1.2K 23.0 130.0 8.98 MB

React components for Bulma framework

License: MIT License

JavaScript 83.01% SCSS 0.15% MDX 16.84%
bulma react-components bulma-framework react css

react-bulma-components's Introduction

React Bulma Components

Build Status Coverage Status Release Version Npm Downloads

React components for Bulma (v0.9.2) UI compatible with most used React Frameworks (Gatsby, CRA, Next.js)

To Install

npm install react-bulma-components or yarn add -E react-bulma-components

Documentation

You can find the documentation in https://react-bulma.dev/en/storybook

Some components may vary the api/naming convention with the Bulma Docs. Please refer to each stories in the Storybook to see how each component could be used

To Use

import React from 'react';
import 'bulma/css/bulma.min.css';
import { Button } from 'react-bulma-components';

export default () => (
  <Button color="primary">My Bulma button</Button>
)

Form elements are imported as part of the Form class.

import { Form } from 'react-bulma-components';

const { Input, Field, Control, Label } = Form;

SASS support

Since CSS logic is separated from this library, there is no special setup required with the library. Simply follow the instructions in the official documentation. You only need to make sure the CSS is properly imported for your website.

Starting from v4, tree shaking is supported, so only the code of the components you have imported will be bundled.

FAQ

Use Button to render a Link from React-Router

We allow custom render component on all our components, to do it you can use the renderAs props like this

import React from 'react';
import { Button } from 'react-bulma-components';
import { Link } from 'react-router';

const CustomLink = ({ to }) => {
  return (
    <Button to={to} renderAs={Link}>
      My react router link
    </Button>
  )
}

Adding ref to a component

We use a custom prop to pass down the ref to the next dom object. (instead to the instance of the component).

const TestComponent = () => {
  const buttonRef = useRef(null);
  return <Button domRef={buttonRef}>button</Button>
}

Why we do this instead of using React.forwardRef? The forwardRef wrap the component into another one, because this is a library for wrapping the Bulma Framework cause an overhead and a lot of noise on the component tab of the React Dev Tools.

react-bulma-components's People

Contributors

cereallarceny avatar cleanshooter avatar codebytere avatar couds avatar daftspunk avatar dependabot[bot] avatar dimitarchristoff avatar diploidal avatar entropy-ibex avatar icyjoseph avatar jbroadice avatar jdmg94 avatar kennethnym avatar koddr avatar luhis avatar mattkenney avatar moetezch avatar mrd9483 avatar n0vad3v avatar niwatolli3 avatar robloach avatar sksamuel avatar sszczep avatar stefl avatar tbirand avatar thetechdabbler avatar torbentee avatar ubaltaci avatar vestial avatar yihangho avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

react-bulma-components's Issues

Unable to Execute Simple commands

Error Message:
Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.

Check the render method of App.

`import React, { Component } from "react";
import {Button, Section , Box, Dropdown, DropdownItem,DropdownDivider } from "react-bulma-components";

import logo from "./logo.svg";
import "./App.css";
import "react-bulma-components/dist/react-bulma-components.min.css";

class App extends Component {
render() {
return (



Normal
Primary
Info
Danger
Warning
Success
White
Light
Dark
Black


Dropdown item
Other Dropdown item
Active Dropdown item
Other Dropdown item

With divider


);
}
}

export default App;

`

2.0.0 missing displayName from all components in the new build and defaultProps boolean noise

Hey

Just upgraded from 1.5.0 to 2.0.0 and noticed all snapshots are now very very different to what they were before.

eg minified name for Columns is v, Card is p etc:

    -       <Columns
    +       <v
    +         backgroundColor={null}
    -       <Card
    +       <p
    +         backgroundColor={null}

this is probably because of webpack 4 optimisation minimise settings for prod where UglifyJS is just being called with defaults. https://webpack.js.org/configuration/optimization/#optimization-minimize

additionally, there seem to be a lot of new defaultProps across the board. eg Card:

    +         clearfix={false}
    +         clipped={false}
    +         hidden={false}
    +         invisible={false}
    +         italic={false}
    +         marginless={false}
    +         overlay={false}
    +         paddingless={false}
    +         radiusless={false}

this is coming from https://github.com/couds/react-bulma-components/blob/master/src/modifiers/index.js#L16

 defaultProps: {
    clearfix: false,
    pull: undefined,
    marginless: false,
    paddingless: false,
    overlay: false,
    clipped: false,
    radiusless: false,
    shadowless: false,
    unselectable: false,
    invisible: false,
    hidden: false,
  },

there is NO need to add any default props of type Boolean with a falsy value, simply omitting it has the same result in 99% of the cases w/o the noise.

How to use it with React FontAwesome component?

Hello.

Would be great to replace icons with React FontAwesome component.

I have no idea what is the rbc rbc-* icons do you use into React Bulma component, for example, Dropdown component? But...

Code is:

import React, { Component } from 'react';

import Hero from 'react-bulma-components/lib/components/hero';
import Dropdown from 'react-bulma-components/lib/components/dropdown';

class SliderHero extends Component {
  render () {
    return (
      <Hero size="fullheight" color="link">
        <Hero.Body>
          <Dropdown hoverable>
            <Dropdown.Item value="item">
              Dropdown item
            </Dropdown.Item>
            <Dropdown.Item value="other">
              Other Dropdown item
            </Dropdown.Item>
            <Dropdown.Item value="active">
              Active Dropdown item
            </Dropdown.Item>
            <Dropdown.Item value="other 2">
              Other Dropdown item
            </Dropdown.Item>
            <Dropdown.Divider/>
            <Dropdown.Item value="divider">
              With divider
            </Dropdown.Item>
          </Dropdown>
        </Hero.Body>
      </Hero>
    );
  }
}

export default SliderHero;

HTML is:

<section className="hero is-link is-fullheight">
  <div className="hero-body">
    <div className="dropdown is-hoverable">
      <div className="dropdown-trigger" role="presentation">
        <a tabIndex="0" className="button">
          <span>Dropdown item</span>
          <span className="icon is-small"><i className="rbc rbc-angle-down"></i></span>
        </a>
      </div>
      <div className="dropdown-menu" id="dropdown-menu" role="menu">
        <div className="dropdown-content">
          <div title="item" role="presentation" className="dropdown-item">Dropdown item</div>
          <div title="other" role="presentation" className="dropdown-item">Other Dropdown item</div>
          <div title="active" role="presentation" className="dropdown-item">Active Dropdown item</div>
          <div title="other 2" role="presentation" className="dropdown-item">Other Dropdown item</div>
          <hr className="dropdown-divider">
          <div title="divider" role="presentation" className="dropdown-item">With divider</div>
        </div>
      </div>
    </div>
  </div>
</section>

And output is:

screen shot 2018-06-16 at 20 03 05

How to solve this OR use FontAwesome instead strange rbc-* icons?
Please help me.

[README] Make review for difference between RBC and React-Bulma package

Hello @couds and team!

I research many React packages, who makes possible to use Bulma CSS Framework into React Components and found interesting thing: still alive and supported only two repos:

  1. https://github.com/kulakowka/react-bulma (too awesome and older repo)
  2. https://github.com/couds/react-bulma-components (our repo)

That's all. Re-Bulma is no longer maintained.

And question is: What's difference between RBC and React-Bulma packages?
Would be great to answer this question on our README for newbie people of Bulma+React ๐Ÿ‘

Warning: Unsafe legacy lifecycles

Getting this error in a console:

Warning: Unsafe legacy lifecycles will not be called for components using new component APIs. Navbar uses getDerivedStateFromProps() but also contains the following legacy lifecycles: componentWillReceiveProps The above lifecycles should be removed.

Using with Next.js

I've attempted to use this project in a fresh Next.js and the various examples that they provide.

However, it is challenging to understand how to properly alias the ~_variables.sass file that this project looks for by default.

Next does not support webpack aliases, and the discussion around that suggests creating a babel alias.

On top of that, setting up Next to be able to handle SASS generation seemed to be quite challenging and I couldn't find any examples.

Does anyone have an example of a Next.js configuration working for this? If not, I'll put a question on Stack Overflow.

For reference, I've made a clean installation of Next.js and react-bulma-components where you can see that it is unable to locate the ~_variables.sass file. As an experiment, if I create that file in the node_modules/react-bulma-components directory as a test, it does find it, but then fails on SASS compilation.

Here's a minimal repo to see the problem: https://github.com/stefl/react-bulma-components-next

Documentation Form

@couds Hi there!

Could you give an example on how we could use your Form and Input to input data and submit ?
As of this point your Storybook doesn't work when we enter data into the fields. When checking the code from your form.story.js it seems you make a High Order Component and wrap it around the Inputs to change their internal state when edited, is this how we should implement it or is it already included? Since your story doesn't seem to update the input field, I think there might be an issue with HoC

screen shot 2017-12-05 at 2 03 53 pm

From the screenshot you can see that when I use your Inputs, Chrome seems to indicate that the event listener attached to the inputs is invalid

I'll try to fork your repo and figure out if there is a bug and how to fix it, or else I'm just plain stupid and I didn't use it right :D

Support TypeScript?

Hello @couds and team.

TypeScript is here and covered React.
I think, react-bulma-components need to add support of TS as soon as possible.

I'm not sure, but this is real "killer feature", because other React+Bulma repos doesn't have TS out of the box. We're may take this and get many stars and users for free!

I'm just learning TypeScript, but I see profit with this solution now.
Thanks!

Failed prop type: Invalid prop `renderAs` supplied to `d`. in d (at DashboardLayout.js:43)

I am trying to use the renderAs-property on the NavBar.Item-component so it uses the @reach/router's Link-component but it looks like renderAs-proeprty doesn't accept the component as input e.g.

<NavBar.Item to="/dashboard" renderAs={Link}>NavItem</NavBar.Item>

I also tried it with Button but getting a similar error: Warning: Failed prop type: Invalid prop `renderAs` supplied to `c`. in c (at DashboardLayout.js:42)

using the code snippet:
<Button to="/dashboard" renderAs={Link}>NavItem</Button>

Version 2.0.0-3 doesn't work with SSR

After updating to 2.0.0-3, I'm getting the window are not defined error. I'm using Next.js so this error likely happened at server side, which make sense. Apart from requiring the component on componentDidMount on every each usage, how can I do it easily? I seems to be getting this from Button, Heading and others.

Navbar UI Query

How can I achieve the following UI using this package?
achieve

Both of the navbars are fixed. Can anyone shed some light on it?

This code shows only one navbar fixed top.

<Navbar
          style={{ backgroundColor: "#ffffffa8" }}
          fixed="top"
          active={this.state.active}
        >
          <Navbar.Brand>
            <Navbar.Item renderAs="a" href="/">
              <img src="images/dv.png" alt="Dew Ventures" />
            </Navbar.Item>

            <Navbar.Burger
              active={this.state.active}
              onClick={this.handleClick}
            />
          </Navbar.Brand>
          <Navbar.Menu active={this.state.active}>
            <Navbar.Container position={"end"}>
              <Navbar.Item href="/">Home</Navbar.Item>
              <Navbar.Item href="/products">Products</Navbar.Item>
              <Navbar.Item href="/about"> About Us</Navbar.Item>
              <Navbar.Item href="/contact"> Contact Us</Navbar.Item>
            </Navbar.Container>
          </Navbar.Menu>
        </Navbar>

How do I add another Navbar on top of it which is also fixed?

Heading classNames mess

Using <Heading> produces a <h1 class="title subtitle"> - the assertion is to check if heading is set and if not, adds class subtitle always.

https://github.com/couds/react-bulma-components/blob/master/src/components/heading/heading.js#L45-L46

adding heading={true} removes subtitle but also removes class title.

aim to me is to get <h1 class="title is-1"> by default - otherwise, if you have different stylings in bulma for title and subtitle, the subtitle colour is applied to your heading.

Cannot Import Form Components

Code:

import React from 'react';
import {Heading, Columns, Field} from 'react-bulma-components';

export default class CreateAccount extends React.Component {
  render() {
    return (
    <Columns>
      <Columns.Column className='has-text-centered'>
        <Heading>
          Create an Account
        </Heading>
        <Field></Field>
      </Columns.Column>
      <Columns.Column className="is-hidden-mobile has-text-centered">
        Right Stuff
      </Columns.Column>
    </Columns>);
  }
}

Error:
screen shot 2018-06-21 at 2 42 56 pm

Version:
1.4.6

No Control, Field, and other components included in the Storybook

The Storybook depicts some components that don't exist within this repo, they're really simple components like Field, Control, Label and others that are depicted mainly in the form examples.
If you try to follow the documentation as is it won't work because the aforementioned components just don't exist within the repo.

screen shot 2018-06-02 at 8 40 37 am

Route Not working inside container

Hi,
(Sorry, i'm opening a lot of issues ^^')

I wanted to try the container component but my routes are not working when inside the container :(

this is my structure :

        <Router>
          <div>
            <MainNav />
            <Container breakpoint="widescreen">
              <Route exact path="/" component={Home} />
              <Route path="/about" component={About} />
              <Route path="/snippets" component={Snippets} />
            </Container>
          </div>
        </Router>

Seems weird because if i wrapped the routes inside a div it is working... Tried to render the container as a divbut it is still not working.

My Link tag are changing this URL but the route is not rendering the correct component. Works again if i remove the Container component.

Do you have an idea on what's going on ?

Documentation - To Use

Firstly thanks for this OSS, I can see this saving a lot of time for those who are looking to use react + bulma.

In the base README.md file there is an instruction to Follow the instructions for creating a _variables.sass for your project which got me a little confused as there aren't any links for doing this nor was it necessary. Is this only for overriding variables? The documentation on npmjs does not have this line.

Documentation for Breadcrumb doesn't work for me

When I copy this example from the documentation, React fails to compile and points to extra curly braces before 'name' parameter.

<Breadcrumb items={[{{name: "Storybook", url: "#1"}}, {{name: "Breadcrumb", url: "#2"}}, {{name: "Breadcrumb Types", url: "#3", active: {true}}}]} />

If I correct it, React says that 'true' is a reserved word and throws another error.
So, the code that works for me is:

<Breadcrumb items={[{name: "Storybook", url: "#1"}, {name: "Breadcrumb", url: "#2"}, {name: "Breadcrumb Types", url: "#3", active: true}]} />

File not found or unreadable

Hi,
I tried to use your package in my project and i got stuck when trying to import the navbar component like this :

import Navbar from 'react-bulma-components/lib/components/navbar';

But i'm stuck and i get this error that i can't fix: :

    @import "~_variables.sass"
    ^
          File to import not found or unreadable: ~_variables.sass.
          in /var/www/snippy-snippets/node_modules/react-bulma-components/lib/components/utils.sass (line 3, column 1)

Couldn't find anything about this issue so i tried to import the navbar component with the other way that you provide on the README :

import { Columns } from 'react-bulma-components';

This import is working But the import way that is not working for me seems to be the "recommended" way in the README so i'd like to find out what is not working :(

this is my webpackconfig :

const HtmlWebPackPlugin = require('html-webpack-plugin');
const autoprefixer = require('autoprefixer');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
const InterpolateHtmlPlugin = require('interpolate-html-plugin');
const ManifestPlugin = require('webpack-manifest-plugin');
const SWPrecacheWebpackPlugin = require('sw-precache-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');

const devMode = process.env.NODE_ENV !== 'production';

const htmlPlugin = new HtmlWebPackPlugin({
  template: './public/index.html',
  filename: './index.html',
  minify: {
    removeComments: true,
    collapseWhitespace: true,
    removeRedundantAttributes: true,
    useShortDoctype: true,
    removeEmptyAttributes: true,
    removeStyleLinkTypeAttributes: true,
    keepClosingSlash: true,
    minifyJS: true,
    minifyCSS: true,
    minifyURLs: true,
  },
});

const cssExtractPlugin = new MiniCssExtractPlugin({
  filename: devMode ? '[name].css' : 'static/css/[name].[hash].css',
  chunkFilename: devMode ? '[id].css' : 'static/css/[name].[hash].chunk.css',
});

module.exports = {
  optimization: {
    minimizer: [
      new UglifyJsPlugin({
        cache: true,
        parallel: true,
        sourceMap: true // set to true if you want JS source maps
      }),
      new OptimizeCSSAssetsPlugin({})
    ]
  },
  entry: {
    index: './src/index.js',
  },
  output: {
    filename: 'static/js/[name].[hash].js',
  },
  devServer: {
    contentBase: './dist',
    hot: true,
  },
  module: {
    rules: [
      {
        test: /\.ico$/,
        loader: 'url-loader',
        options: {
          limit: 1,
          name: '[name].[ext]',
        },
      },
      {
        test: /\.(js|jsx)$/,
        exclude: /node_modules/,
        use: [
          'babel-loader',
          'eslint-loader',
        ],
      },
      {
        test: /\.html$/,
        use: [
          {
            loader: 'html-loader',
            options: { minimize: true },
          },
        ],
      },
      {
        test: /\.(css|sass|scss)$/,
        use: [
          devMode ? 'style-loader' : MiniCssExtractPlugin.loader,
          {
            loader: 'css-loader',
            options: {
              minimize: true,
            },
          },
          {
            loader: 'postcss-loader',
            options: {
              autoprefixer: {
                browsers: ['last 2 versions'],
              },
              plugins: () => [
                autoprefixer,
              ],
            },
          },
          {
            loader: 'sass-loader',
            options: {},
          },
        ],
      },
      {
        loader: 'file-loader',
        // Exclude `js` files to keep "css" loader working as it injects
        // it's runtime that would otherwise processed through "file" loader.
        // Also exclude `html` and `json` extensions so they get processed
        // by webpacks internal loaders.
        exclude: [/\.(js|jsx|mjs)$/, /\.html$/, /\.json$/, /\.(css|sass|scss)$/],
        options: {
          name: 'static/media/[name].[ext]',
        },
      },
    ],
  },
  //  extensions that webpack should resolve without explicit declaration
  resolve: {
    extensions: ['.js', '.jsx'],
  },
  plugins: [
    htmlPlugin,
    cssExtractPlugin,
    new InterpolateHtmlPlugin({
      'NODE_ENV': 'development'
    }),
    new ManifestPlugin({
      fileName: 'asset-manifest.json', // Not to confuse with manifest.json 
    }),
    new SWPrecacheWebpackPlugin({
      // By default, a cache-busting query parameter is appended to requests
      // used to populate the caches, to ensure the responses are fresh.
      // If a URL is already hashed by Webpack, then there is no concern
      // about it being stale, and the cache-busting can be skipped.
      dontCacheBustUrlsMatching: /\.\w{8}\./,
      filename: 'service-worker.js',
      logger(message) {
        if (message.indexOf('Total precache size is') === 0) {
          // This message occurs for every build and is a bit too noisy.
          return;
        }
        /* eslint-disable-next-line */
        console.log(message);
      },
      minify: true, // minify and uglify the script
      navigateFallback: '/index.html',
      staticFileGlobsIgnorePatterns: [/\.map$/, /asset-manifest\.json$/],
    }),
    new CopyWebpackPlugin([
      { from: 'public' }, // define the path of the files to be copied
    ]),
  ],
};

Do you have an idea about what am i doing wrong or anything else ?

Thank you !

Dropdown behaviour of showcase can not be reproduced

Let me start by saying I am sorry if I am cross posting I just realised that I am having more trouble in my example at https://github.com/jonalv/bulma-react-example than just only the icon not showing up and thus this should probably be a ticket of it's own...

I am trying to follow the instructions at: https://couds.github.io/react-bulma-components/?selectedKind=Dropdown&selectedStory=Default&full=0&addons=1&stories=1&panelRight=0&addonPanel=storybook%2Fstories%2Fstories-panel

I don't get the little triangle pointing down on the Dropdown menu but the behaviour of the Dropdown is not correct either since the hover effect on the dropdown is not showing a pointer hand (as on links) thingie (if you know what I mean?:). Either something is broken or I am doing something wrong and then maybe the instructions could be extended?

Navbar not working anymore even with props to toggle it

Hi,

Yeah... That's me again, sorry ๐Ÿ˜ž ...

Navbar doesn't work anymore in 2.0.0-8, i tried to add active or is-active or anything i could find in the source code (i don't understand all of it so i've probably missed something) but it's not working on storybook too anymore so i'm guessing something is wrong ?
Can you check please ?

I'll be glad to help if i can !

thanks for the hard work ๐Ÿ‘

Forms won't import at the root

I'm forced to import the Field, Control, and Input (and likely other modules) at react-bulma-components/lib/components/form rather than at react-bulma-components.

This works:

import {
  Columns,
  Heading,
  Box,
  Container,
  Section,
  Button,
  Level,
  Card,
  Media,
  Image,
  Content,
  Tag,
  Message,
  Hero
} from 'react-bulma-components';

import {
  Field,
  Control,
  Input
} from 'react-bulma-components/lib/components/form';

This does not work:

import {
  Columns,
  Heading,
  Box,
  Container,
  Section,
  Button,
  Level,
  Card,
  Media,
  Image,
  Content,
  Tag,
  Message,
  Hero,
  Field,
  Control,
  Input
} from 'react-bulma-components';

Setting Font in _variable.sass has no affect

I can set colors and other changes in _variable.sass but changing the font doesn't affect anything.

$family-serif: "Merriweather", "Georgia", serif;
$family-primary: $family-serif;

"icon" prop required for Icon component but not used with children

In Icon component, when children are given, the icon prop isn't used but icon prop is marked as required:

Personally, I'm using react-fontawesome to pass is icon component as a child to the react-bulma-components icon component but prop-validation throws an error.

Modal is not working

Hello,
Modal doesn't seem to work
<OpenModal modal={{ closeOnEsc: false }}> <Modal.Content> <Section style={{ backgroundColor: "white" }}> Click on the "X" button on the top-right button to close the Modal (pass closeOnEsc=false to the modal to avoid closing it with the keyboard) </Section> </Modal.Content> </OpenModal>
And I am getting this error :

Unhandled Rejection (Invariant Violation): Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.

Please help me.

Component documentation

Hi, I found it very confusing as a new user of the library, because many of the components are namespaced but not others.

For example, to access the Button component, you can import it directly

import { Button } from 'react-bulma-components/full'

<Button>

But to access the Input component, you need to go into the Form object:

import { Form } from 'react-bulma-components/full'

<Form.Input/>

However this isn't documented anywhere! Am I missing something obvious here?

auto-close mobile menu on Navbar.Item click or location change

the requested change is simple, pass toggleMenu to the Item elements in the render method of Navbar by adding the following lines.

if ([Item].includes(child.type)) {
    return React.cloneElement(child, { active: this.state.showMobileMenu, toggleMenu: this.toggleMenu });
}

then give us a boolean prop like autoclose or closeable on Navbar.Item which toggles the menu on the click event before its actual callback if any

Colors not set in default Bulma SASS but implied in project components

Problem

The prop color has no effect when using the Tile component with Bulma using modular style component imports.

This is because the Bulma package itself has no styles for colors in bulma/sass/grid/_tiles.sass. By comparison, using the Hero component, the color prop works, the styles are set correctly, ie .hero.is-primary.

<Tile renderAs="article" kind="child" notification color="primary">
  <Heading>Tile...</Heading>
</Tile>

I suspect other components will suffer from this but haven't inspected further yet.

Proposed Solution

Should styles be added to the component's themselves to support colors since it is implied to work via the Storybook?

--or--

Should the styles be added to Bulma directly?

Warning on Using some Bulma Controls

React does not recognize the renderAs prop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute, spell it as lowercase renderas instead. If you accidentally passed it from a parent component, remove it from the DOM element.
in figure (created by Image)
in Image (at App.js:33)
in figure (created by MediaItem)
in MediaItem (at App.js:32)
in article (created by Media)
in Media (at App.js:31)
in div (created by Card.Content)
in Card.Content (at App.js:30)
in div (created by Card)
in Card (at App.js:25)
in div (created by Section)
in Section (at App.js:24)
in App (at index.js:7)

Updated to newest React and get this error

I went from 15 to v16 the latest version and I get this error:

warning.js:33 Warning: Unsafe legacy lifecycles will not be called for components using new component APIs.

Navbar uses getDerivedStateFromProps() but also contains the following legacy lifecycles:
  componentWillReceiveProps

The above lifecycles should be removed. Learn more about this warning here:

Form example throws 'not defined' errors

I was trying the example here by importing the form component like that:

import { Form } from 'react-bulma-components';

But I'm getting a long list of errors from react:

Line 9:   'Field' is not defined       react/jsx-no-undef
Line 10:  'Label' is not defined       react/jsx-no-undef
Line 11:  'Control' is not defined     react/jsx-no-undef
...

Trying to import each component doesn't seem to be working either. Any idea what I'm missing?

How to use Button with Link from react-router-dom?

Hello @couds and team :)

It's not allow in documentation, but still huge important thing โ€” how to use Button component from react-bulma-components with Link from react-router-dom?

For example:

import React, { Component } from 'react';
import { Link } from 'react-router-dom';

import Columns from 'react-bulma-components/lib/components/columns';
import Heading from 'react-bulma-components/lib/components/heading';
import Button from 'react-bulma-components/lib/components/button';

class Navigation extends Component {
  render () {
    return (
      <Columns className="has-vertical-centered is-mobile" multiline>
        <Columns.Column>
          <div className="field is-grouped is-pulled-right">
            <p className="control">
              <Link to="/account">
                <Button color="white" className="is-rounded">
                  <span>My Account</span>
                </Button>
              </Link>
            </p>
          </div>
        </Columns.Column>
      </Columns>
    );
  }
}

export default Navigation;

And generated html code is:

<div className="has-vertical-centered is-mobile columns is-multiline">
  <div className="column">
    <div className="field is-grouped is-pulled-right">
      <p className="control">
        <a href="/account">
          <a tabIndex="0" className="is-rounded is-white button">
            <span>My Account</span>
          </a>
        </a>
      </p>
  </div>
</div>

I mean one <a> tag into another <a> tag โ€” it's strange and not valid. Okay, I can use renderAs props for Button to change tag to, for example, <span>. But if I do that, I get this error message in Chrome console:

Warning: Failed prop type: Invalid prop `renderAs` supplied to `Button`.
    in Button (at Navigation.js:19)
    in Navigation (at LandingIndex.js:12)
    in div (at LandingIndex.js:11)
    in div (at LandingIndex.js:10)
    in div (at LandingIndex.js:9)
    in LandingIndex (created by Route)
    in Route (at index.js:18)
    in Switch (at index.js:17)
    in Router (created by BrowserRouter)
    in BrowserRouter (at index.js:16)

How can I work via react-router-dom in right valid way? Please help ;)

P.S. and one more question.. what component may help me to replace this CSS classes to components: field is-grouped and its options, like is-pulled-right (or center/left)?

File to import not found or unreadable: ~_variables.sass in Gatsby.js

I'm attempting to use react-bulma-components with a new Gatsby.js site.

After installing, importing any component, I get the error that ~_variables.sass is not found.

My intention is just to use the default styles to get going, but it seems that I'm missing how to specify this path, or indeed that the SASS setup for my project doesn't seem to be correct. I have other SASS files that work as expected in this project.

Here's the error trace:


 ERROR  Failed to compile with 1 errors                                                                                                                 11:53:00

 error  in ./~/react-bulma-components/lib/components/hero/hero.sass

Module build failed:
@import "~_variables.sass"
^
      File to import not found or unreadable: ~_variables.sass.
      in /apps/foundrs/node_modules/react-bulma-components/lib/components/utils.sass (line 3, column 1)

 @ ./~/react-bulma-components/lib/components/hero/hero.sass 4:14-120 13:2-17:4 14:20-126

The solution is to add the following to Gatsby's gatsby-node.js file (assuming your _variables.sass file is in src/style/_variables.sass:

exports.modifyWebpackConfig = ({config, env}) => {
  config.merge({
    resolve: {
      alias: {
        '_variables.sass': path.resolve(__dirname, 'src/style/_variables.sass')
      }
    }
  })
  return config
}

Should I add a section to the documentation to show this solution or to help resolve this gotcha?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.