Git Product home page Git Product logo

Comments (5)

1egoman avatar 1egoman commented on August 23, 2024 1

@f0rr0 Sorry I misunderstood what you asked before!

I like that pattern that you described a lot. I don't currently have time to dive into this myself, but if you want to update and make a pull request, then I'll merge it in. The only thing I'd ask is to try and maintain backwards compatibility, but if you can't, no big deal.

As a stop-gap measure or if you don't have the time to PR, you could write your own small component that extends the component I've written with a custom render function. (below is untested, but should get the idea across)

import {FunniesComponent} from 'funnies';
class MyCustomFunniesComponent extends FunniesComponent {
  render() {
    return <div className="funnies funnies-custom">
      <span>Here's a funny loading message: {this.state.message}</span>
    </div>;
  }
}

from funnies.

1egoman avatar 1egoman commented on August 23, 2024

Hello @f0rr0!

All the messages are hardcoded here: https://github.com/1egoman/funnies/blob/master/src/funnies.js

If you want to use custom messages you should be able to do something like:

import {FunniesComponent} from 'funnies';
<FunniesComponent customMessages={["You're too funny", "Thinking really hard..."]} />

Keep in mind this will only use those two messages and not append to what is already there.

If you have any more funny messages, consider contributing them as a pull request!

If I'm misunderstanding your question, feel free to elaborate.

Thanks!

from funnies.

f0rr0 avatar f0rr0 commented on August 23, 2024

Hey @1egoman! Great work. What I meant was, currently, the component renders a <h1>Loading</h1> and some, other markup along with loading messages. That is too inflexible for everyone's use case. Maybe, you could just wrap the messages in CSSTransitionGroup with prop component=span (or div etc.) and a user supplied className. That way one can add custom styles etc. and use custom wrapping markup.

from funnies.

f0rr0 avatar f0rr0 commented on August 23, 2024

Hey @1egoman! I moved to a completely custom solution (borrowed your funny messages though!)
However, I'll take this up when I have a little more time. You could also look into using webpack or rollup to reduce the bundle size. I think the current set up includes the entire radium dist. That's not apt for a component that just shows funny messages IMO.

from funnies.

1egoman avatar 1egoman commented on August 23, 2024

I don't have time to jump into this right now, though I'm pretty sure it's a trivial task. I'd love for someone to take this on!

Task copied from above:

You could just wrap the messages in CSSTransitionGroup with prop component=span (or div etc.) and a user supplied className. That way one can add custom styles etc. and use custom wrapping markup.

from funnies.

Related Issues (12)

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.