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

[RFR] Add aside support in List, Edit, and Show views #2304

Merged
merged 7 commits into from
Sep 13, 2018
Merged

[RFR] Add aside support in List, Edit, and Show views #2304

merged 7 commits into from
Sep 13, 2018

Conversation

fzaninotto
Copy link
Member

@fzaninotto fzaninotto commented Sep 11, 2018

  • Add aside support in Create view
  • Add aside support in Edit view
  • Add aside support in Show view
  • Add aside support in List view
  • Document it
  • Add integration tests

Users may need to see info related to the current content, but secondary. Using tabs for that has one drawback: it is contained in the form, and the presence of the "save" button makes the content not secondary.

Besides, adding a second column requires overriding the View, which is advanced customization.

The aside prop is style agnostic, and allows for all sorts of customizations thanks to flexbox.

const Aside = () => (
    <div style={{ width: 200, margin: '1em' }}>
        <Typography variant="title">App Users</Typography>
        <Typography variant="body1">
            Eiusmod adipisicing tempor duis qui. Ullamco aliqua tempor incididunt aliquip aliquip qui ad minim aliqua. Aute et magna quis pariatur irure sunt. Aliquip velit consequat dolore ullamco laborum voluptate cupidatat. Proident minim reprehenderit id dolore elit sit occaecat ad amet tempor esse occaecat enim. Laborum aliqua excepteur qui ipsum in dolor et cillum est.
        </Typography>
    </div>
);

const UserShow = ({ permissions, ...props }) => (
    <Show aside={<Aside />} {...props}>
        ...
    </Show>

2018-09-11_1214

@fzaninotto fzaninotto added this to the 2.4.0 milestone Sep 11, 2018
@ashim-kr-saha
Copy link
Contributor

ashim-kr-saha commented Sep 11, 2018

User should able to hide/show <Aside /> component on demand.

@fzaninotto
Copy link
Member Author

@ashim-k-saha that'd be up to you: you can implement your own Aside component with a show/hide logic.

</Edit>
```

The `aside` component receives the same props as the `Edit` child component: `basePath`, `record`, `resource`, and `version`. That means you can display non-editable details of the current record in the aside component:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we add something about Create too ?

@fzaninotto fzaninotto changed the title [WIP] Add aside support in List, Edit, and Show views [RFR] Add aside support in List, Edit, and Show views Sep 11, 2018
@djhi djhi merged commit a585c5e into next Sep 13, 2018
@djhi djhi deleted the aside branch September 13, 2018 12:56
@rabbititus
Copy link

Is it possible to use <Aside/> component on top of the <List/>?

@fzaninotto
Copy link
Member Author

I believe so, CSS is your friend!

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

Successfully merging this pull request may close these issues.

4 participants