Skip to content
This repository has been archived by the owner on Jun 17, 2024. It is now read-only.

How do you manage integrating Bootstrap with inline styles using aphrodite? #133

Closed
kennetpostigo opened this issue May 26, 2016 · 8 comments

Comments

@kennetpostigo
Copy link

No description provided.

@kennetpostigo kennetpostigo changed the title How do you manage integrating Bootstrap with inline styles using aphrodite How do you manage integrating Bootstrap with inline styles using aphrodite? May 26, 2016
@kentcdodds
Copy link
Owner

If you're using a CSS framework like Bootstrap, then things don't really change from the perspective of how you utilize the framework. The only thing that's different is how you do your extra styles with your own components.

I've created an example to show you what I mean: https://jsbin.com/lesehu/edit?js,output

Let me know if you have any questions!

@kentcdodds
Copy link
Owner

Here's a gif:

giphy

@kennetpostigo
Copy link
Author

@kentcdodds, awesome thanks!

@kentcdodds
Copy link
Owner

For some reason the jsbin takes a while to load. Here's a codepen: http://codepen.io/kentcdodds/pen/xOxxGb/

@yantakus
Copy link

Hi, @kentcdodds. Is there a way to import bootstrap's variables and use them in a component with aphrodite? That would be very useful. Converting them from sass to js manually isn't fast and easy. May be there's a solution I don't know?

@kentcdodds
Copy link
Owner

Unfortunately not, though you may be able to use some kind of parser to get them for a one-time conversion to make that easier

@MaxwellGover
Copy link

MaxwellGover commented Apr 27, 2017

I'm using React but the following doesn't seem to work for me when trying to style the button.

import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { StyleSheet, css } from 'aphrodite';

const DashNavBar = props => {
  return (
    <nav>
      <a className="navbar-brand" href="#">App</a>
      <button className="btn btn-default ${css(styles.button)}">Maxwell Gover</button>
    </nav>  
  ); 
};

DashNavBar.propTypes = {
  // Add props
};

const styles = StyleSheet.create({
  nav: {
    display: 'flex',
    flexDirection: 'row',
    alignItems: 'center',
    backgroundColor: 'green',
    paddingTop: 5,
    paddingBottom: 5
  },
  button: {
    backgroundColor: 'blue',
    cursor: 'pointer',
    borderRadius: 3,
    padding: 15
  }  
});

@14850842
Copy link

14850842 commented Sep 7, 2017

@MaxwellGover <button className={`btn btn-default ${css(styles.button)}`>Maxwell Gover</button>

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants