Giter VIP home page Giter VIP logo

Comments (7)

tleunen avatar tleunen commented on July 25, 2024

Not sure to understand.
In the title of the header, you're not using a text string, but a dom node? Is that the issue?

from react-mdl.

faergeek avatar faergeek commented on July 25, 2024

Exactly 👍

from react-mdl.

tleunen avatar tleunen commented on July 25, 2024

I think only strings are allowing based on the MDL spec, but we could probably allow node/component as well and assign the mdl-layout-title class on it.

from react-mdl.

faergeek avatar faergeek commented on July 25, 2024

I'm not sure if it matters.
Users can just put some span or strong tag there or some complicated custom markup and I wouldn't restrict them.
I'm also not sure if mdl-layout-title is necessary or not.

from react-mdl.

markuso avatar markuso commented on July 25, 2024

I have the same need where I just need to pass some markup instead of a string to the title prop as I need to display two pieces of information, like: "Area / The Title", where I pass <span><span style={{ color: '#ddd' }}>Area / </span><strong>The Title</strong></span> as the title. See a real example in the screenshot below.

screen shot 2015-09-28 at 5 47 54 pm

The title props in the Header and HeaderRow components just needs their propTypes changed to any or specific types (string, number, element, node). That takes care of everything. We then could even pass it something like <span><Icon name="..." /> The Area Title</span>.

This would be very useful and it would not impact anything else. The MDL specs never took the React way of coding into consideration and the need to pass components around that displays formatted text. I hope you will consider this.

Update: I would love to see the same done to CardTitle which will make it so much more useful.

from react-mdl.

tleunen avatar tleunen commented on July 25, 2024

CardTitle already accepts anything as a child, but in that case it won't use the default h2.mdl-card__title-text.

The reason for that is because of the Event card in the demos: https://github.com/tleunen/react-mdl/blob/master/demo/card/card.js#L51-L57

from react-mdl.

markuso avatar markuso commented on July 25, 2024

That is fantastic Tommy. Thank you.

from react-mdl.

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.