Coder Social home page Coder Social logo

react-router-tabs's People

Contributors

01abhishekjain avatar chacestew avatar derozn avatar gaurav414u avatar rui-ferreira avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

react-router-tabs's Issues

Conditional `NavTab` child

Would it be possible to handle conditional tabs? Currently If I add a condition to display or not a tab it throws an error

image

<RoutedTabs startPathWith={match.url} className="page__tabs">
    <NavTab to={isNew ? '' : '/details'}>Details</NavTab>
    {!isNew && <NavTab to="/merge">Merge</NavTab>}
</RoutedTabs>

Here is a potential fix

const enhancedChildren = React.Children.map(children, tab => {
    if (!tab) return;
...

Thanks, great plugin!

The prop "to" could be an object, instead of a string

to: PropTypes.string.isRequired,

The propType validation require to to be a string, but it could be an object as well.

For example, I might use NavTab to relay the search part of the URL, like so:

<NavTab to={{pathname:'some/path', search:this.props.location.search}}>Beam me up!</NavTab>
instead of
<NavTab to={'some/path'}>Beam me up!</NavTab>

So, I think the validation needs to be updated accordingly. Should I submit a PR for the same?

TypeError: Cannot read property 'to' of undefined

Hi, I tried the example from the github readme, bur I get this error message:

TypeError: Cannot read property 'to' of undefined
(anonymous function)
node_modules/react-router-tabs/lib/RoutedTabs.js:40
  37 | var props = tab.props;
  38 | 
  39 | 
> 40 | var to = _typeof(props.to) === 'object' ? _extends({}, props.to, { pathname: startPathWith + props.to.pathname }) : startPathWith + props.to;
  41 | 
  42 | return _react2.default.cloneElement(tab, _extends({
  43 |   to: to,

Using Tabs in a list

I'm curious if there is any way to use the Tabs as part of an unordered list.

<RoutedTabs startPathWith={match.url}>
  <ul>
    {items.map(({ name, slug }) => (
      <li>
        <NavTab
           key={slug}
            to={`/${slug}`}
         >
           {name}
         </NavTab>
       </li>
      ))}
   </ul>
</RoutedTabs>

Currently, the RoutedTabs component passes all the props to its children so in the case of a list it passes these props to the li element instead of the NavTab (child of li) resulting in its functionality being lost.

Thanks

Improve module bundling and transpilation

Module bundling was a bit rushed at the outset and should be updated. My thoughts so far:

  1. Move to rollup
  2. Consider adding a UMD build
  3. Check what babel options we need (might be a good idea to try match react-router here)
  4. Update dependencies
    ...
  5. Check if any of the above are breaking and semver accordingly

The first 4 aren't necessarily ordered, but it makes sense to try do them at the same time.

Input and pull requests are very welcome.

Be able to reselect a tab

Hello

My tabs contains some inner navigation. I need to be able to go back to the default/home tab when I reselect a currently selected tab. Is that already possible?

In short: If I am at /tab1/subroute clicking on Tab 1 would send me to /tab1

Close Tab

Is there any way to add close icon or some other way to close Tab?

Nested Tabs and multiple active classes

Hi -

Just discovered this component and it works like a charm. I'm hoping that there is a way to accomplish this:

I have a Parent component with a set of Tabs that each display a Child component that has it's own set of Tabs. When one of the nested Tabs is clicked the parent Tab loses its active state. I would like to still highlight the parent Tab while navigating through the children Tabs.

Hopefully that makes sense!

Thanks

Support unmountOnExit

A feature I love in react bootstrap's tab implementation is the ability to have a component not unmount when a tab is navigated away from (simply hide it). This makes it much easier to restore complex state as we may have some complicated form, google maps, etc in our tabs. It may be out of scope for a project like this, but it would be amazing!

Keep tabs mounted

Hello,
my use-case involves adding a new tab whenever the user visits a new url. The user can also remove each tab individually.
The problem I am facing right now is that I want each tab component to remain mounted, assuming there is a form in Tab1, when the user visits Tab2 and goes back to Tab1, he'd expect the form to still be filled with whatever he entered.

So my question is: Is there some way to do this? To keep active tab components mounted and unmount them only when the user manually closes said tab?

Any help at this point would be most helpful.
Thank you.

Combine NavTab and Route into one element

Not an issue, just suggestion.

It would be nice to have component prop for NavTab. It could act like a wrap for Switch/Route and will allow to reduce boilerplate.
Example:

<NavTab to="/admins" component={Admins}>Admins</NavTab>
<NavTab to="/moderators" component={Moderators}>Moderators</NavTab>
<NavTab to="/users" component={Users}>Users</NavTab>

would compile to

<Switch>
  <Route... />
  <Route... />
  ...
</Switch>

block after the last NavTab element.

How do you use this with Material UI?

Is there anyway I can put a NavTab inside of a Material UI Tab or vice versa so that it has the visual appearance and effects of a Material UI Tab but still the navigation functionality of NavTab?

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.