Code Monkey home page Code Monkey logo

Comments (3)

sgwilym avatar sgwilym commented on July 22, 2024 2

Maybe I'll have to do both.

  • People will probably want to do other things that require reading/changing state. I imagine that adding onTabChange, activeTab props would probably do it.
  • I'm trying to strike the balance between having Earthbar be flexible and having it be useful out the box. Being able to click outside of the box to close a tab seems like a pretty common request. I need to think a bit harder about this...

from react-earthstar.

sgwilym avatar sgwilym commented on July 22, 2024

Because the Earthbar's presentation is meant to be determined by the app using it (it could be horizontal, vertical, tabs, a drawer…) I think doing this in Twodays Crossing might be the right place actually. Baking into this library would be making too much of an assumption, imo.

from react-earthstar.

cinnamon-bun avatar cinnamon-bun commented on July 22, 2024

@sgwilym I can't find a way to do this from outside of react-earthstar.

My goal was to make a giant div that would cover the entire screen, sitting just behind the tab panel, with an onClick event that closes the tab. I ran into some difficulties:

  • I think the app doesn't have the ability read or change the Earthbar's tab state from the outside?
    • It can't know when to draw the giant div itself
    • It can't close the tab
  • I tried adding the giant div as a ::before pseudo-element on the actual Earthbar tab using just CSS.
    • Turns out pseudo-elements can't have onClick handlers

Ways for React-earthstar to help

  • Render a div that, when clicked, closes a tab. It could be hidden by default and apps can override the CSS to make it into a screen-covering giant div like I was trying to make
  • Or somehow expose the tab state to the app so it can be read and changed. I'm not sure how, since the Earthbar and the app are siblings in the tree.

from react-earthstar.

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.