Coder Social home page Coder Social logo

custom style not propagated about react-tabtab HOT 4 CLOSED

ctxhou avatar ctxhou commented on June 1, 2024
custom style not propagated

from react-tabtab.

Comments (4)

ddelpiano avatar ddelpiano commented on June 1, 2024

one more note, I am using the version 1.8.4 of the library and consequent 3.4.1 of the style library since this project still use React 15.

from react-tabtab.

kapilpipaliya avatar kapilpipaliya commented on June 1, 2024

I have exactly same problem.
I think problem is in this line:

${props => props.active && !props.vertical ?
    ` border-bottom: 2px solid #f6b2b5;` : null}
        &:hover {
            background-color: transparent;
        }`

from react-tabtab.

ddelpiano avatar ddelpiano commented on June 1, 2024

@kapilpipaliya I don't this so, I dug in the Tabs and Tab components a bit and I can see there is a style kind of hardcoded in the component itself used if the CustomTabStyle is undefined, that is using white for the background-color.
As you can see I changed the background color in all the custom styles to have a light blue or whatever (did not really care, anything different than white) but still I can see the white when this render.

from react-tabtab.

ddelpiano avatar ddelpiano commented on June 1, 2024

Found the problem.
I was using export default and this was causing an issue underneath since the TabList component was looking for the customStyle.Tab component where the style was defined, but this was under customStyle.default.Tab, so the previous resulted with an undefined component and was taking the hardcoded style.

Code changed

var styled = require('react-tabtab').styled;
let {TabListStyle, ActionButtonStyle, TabStyle, PanelStyle} = styled;

TabListStyle = TabListStyle.extend`background-color: #009988;`;

TabStyle = TabStyle.extend`background-color: #009988;transition: color .28s ease;`;

ActionButtonStyle = ActionButtonStyle.extend`
background-color: #009988; border-radius: 0; &:hover { background-color: #eee; }`;

PanelStyle = PanelStyle.extend`
background-color: #009988;
border-left: 1px solid rgba(0,0,0,0.12);
border-right: 1px solid rgba(0,0,0,0.12);
border-bottom: 1px solid rgba(0,0,0,0.12);
padding: 30px 30px;
transition: box-shadow .25s, -webkit-box-shadow .25s;
border-radius: 2px;
`;

// need to follow this object naming
module.exports = {
    TabList: TabListStyle,
    ActionButton: ActionButtonStyle,
    Tab: TabStyle,
    Panel: PanelStyle
};

@kapilpipaliya I hope this will help you, cheers.

from react-tabtab.

Related Issues (20)

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.