Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to use as={Menu} component class? #14

Open
jiangts opened this issue Sep 27, 2018 · 2 comments
Open

how to use as={Menu} component class? #14

jiangts opened this issue Sep 27, 2018 · 2 comments

Comments

@jiangts
Copy link

jiangts commented Sep 27, 2018

In an example at https://react.semantic-ui.com/modules/sidebar/#states-visible there's a snippet like this:

import React from 'react'
import { Header, Icon, Image, Menu, Segment, Sidebar } from 'semantic-ui-react'

const SidebarExampleVisible = () => (
  <Sidebar.Pushable as={Segment}>
    <Sidebar as={Menu} animation='overlay' icon='labeled' inverted vertical visible width='thin'>
      <Menu.Item as='a'>
        <Icon name='home' />
        Home
      </Menu.Item>
      <Menu.Item as='a'>
        <Icon name='gamepad' />
        Games
      </Menu.Item>
      <Menu.Item as='a'>
        <Icon name='camera' />
        Channels
      </Menu.Item>
    </Sidebar>

    <Sidebar.Pusher>
      <Segment basic>
        <Header as='h3'>Application Content</Header>
        <Image src='/images/wireframe/paragraph.png' />
      </Segment>
    </Sidebar.Pusher>
  </Sidebar.Pushable>
)

export default SidebarExampleVisible

How do I translate as={Segment} or as={Menu}?

@jiangts
Copy link
Author

jiangts commented Sep 27, 2018

ok after reading your source I came up with just doing
:as (.-Menu js/semanticUIReact) but that's a little nasty.

I tried (r/reactify-component sa/Menu) but that didn't work...

According to http://reagent-project.github.io/docs/master/InteropWithReact.html
adapt-react-class and reactify-component aren't completely symmetrical.

What do you think about exporting a version of all the SUI components suffixed by "original" or suffixed by "Raw"? e.g. sa/MenuOriginal

@gadfly361
Copy link
Owner

Here is an issue showing how I implemented a sidebar, but it essentially uses the nasty trick you mentioned.

There is probably room to wrap that in soda-ash or to better document it ... I don't have a strong feeling either way yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants