npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

coderwelsch-react-bulma-components

v2.2.0

Published

React components for Bulma framework

Downloads

12

Readme

React-bulma-components

Build Status Coverage Status Release Version Npm Downloads

React components for Bulma (v0.7.1) framework

This is an implementation of the Bulma Framework Component in React by Jeremy Thomas.

You can find the Storybook stories of all components here

BREAKING CHANGES:

  • Dropped support for react < 16.2
  • Navbar Menu its now a controlled component. there is a prop to show/hide the mobile menu

To Install

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

To Use

Follow the instructions for creating a _variables.sass for your project, then:

import React from 'react';
// You can import from the global component (you will need to include the css file dist/react-bulma-components.min.css)
import { Columns } from 'react-bulma-components';

// You can also include the js that also bundles the css (do not work with server-side rendering)
import { Columns } from 'react-bulma-components/full';

// [RECOMENDED] Or import only the components you will use (this will reduce the total bundle size)
// If you use this approach and want to use the global Bulma styles, import react-bulma-components/src/index.sass and configure webpack to handle sass files
import Columns from 'react-bulma-components/lib/components/columns';

export default () => (
  <Columns>
      <Columns.Column>
        First Column
      </Columns.Column>
      <Columns.Column>
        Second Column
      </Columns.Column>
      <Columns.Column>
        Third Column
      </Columns.Column>
      <Columns.Column>
        Fourth Column
      </Columns.Column>
    </Columns>
);

Documentation

You can find the documentation in https://couds.github.io/react-bulma-components

Each component imports their own sass file. Thus, you can reduce your css total file size by only including the styles that you will use. To enable this, please configure your Webpack to handle sass files. You can use the webpack.config.js on the root folder of this repository.

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 (you can find the source code of the story by using the button "Show info" on the top-right corner of the page).

The following components were ported:

Override Bulma variables

To override the variables set by Bulma you will need to create a sass file like this one (_variable.sass):

@import '~bulma/sass/utilities/initial-variables.sass'

// ADD HERE variables you want to override
$primary: #f4f4f4

@import '~bulma/sass/utilities/_all.sass'

It may be necessary, depending on your project setup, to create this file, even if you do not intend on overriding default styles.

After that you will need to add an alias pointing to the file to your webpack configuration

resolve {
  // Other resolve props
  alias: {
    // Other aliases
    '_variables.sass': path.resolve(__dirname, 'relative/path/from/webpack/config/to/your/_variables.sass'),
  },
}

For Gatsby.js v1 you can add a modifyWebpackConfig export to your gatsby-node.js file:

exports.modifyWebpackConfig = ({config, env}) => {
  config.merge({
    resolve: {
      alias: {
        '_variables.sass': path.resolve(__dirname, 'relative/path/from/webpack/config/to/your/_variables.sass')
      }
    }
  })
  return config
}

For Gatsby.js v2 you can add a onCreateWebpackConfig export to your gatsby-node.js file:

const path = require('path')

exports.onCreateWebpackConfig = ({
  stage,
  getConfig,
  rules,
  loaders,
  actions,
}) => {
  actions.setWebpackConfig({
    resolve: {
      alias: {
        '_variables.sass': path.resolve(__dirname, 'relative/path/from/webpack/config/to/your/_variables.sass'),
      },
    },
  })
}

Override Bulma variables in CRA without eject

Sometimes, you don't want to eject your CRA (Create React App) application. But how to make custom style variables for Bulma? There is a simple and right way to solve it!

First of all, install package node-sass-chokidar (docs):

$ npm install --save node-sass-chokidar

Or, if you use yarn:

$ yarn add -E node-sass-chokidar

For example, we're using dir structure, like this:

├── ...
├── public
│   └── ...
└── src
    ├── scss
    │   ├── _variables.scss     <-- Override Bulma variables here
    │   └── style.scss          <-- Entry styles (main)
    ├── ...
    └── style.css               <-- Output CSS file

Next, import ./src/style.css into your main React app file (if not) ./src/index.js:

import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';

import './style.css'; // <-- This our output CSS file

ReactDOM.render(
  <App/>,
  document.getElementById('root')
);

Don't forget to import _variables.scss into head of style.scss.

And now, just add to scripts section in your ./package.json two commands:

{
  "scripts": {
    // ...
    "build-css": "node-sass-chokidar --include-path ./src/scss --include-path ./node_modules src/scss/ -o src/",
    "watch-css": "npm run build-css && node-sass-chokidar --include-path ./src/scss --include-path ./node_modules src/scss/ -o src/ --watch --recursive"
  }
}

Open console (in your CRA dir), type npm run watch-css or yarn run watch-css and hit enter. Now, node-sass-chokidar will automatically update ./src/style.css, when you make any changes in ./src/scss/style.scss file for you!

This page is open source. Noticed a typo? Or something unclear? Improve this page on GitHub