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

Update PlacesDetailPanel with more flexible styling #264

Closed
wants to merge 9 commits into from
2 changes: 1 addition & 1 deletion packages/core-data/src/components/PlaceDetailsPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const PlaceDetailsPanel = (props: Props) => {

return (
<aside
className='flex flex-col absolute z-10 h-full w-[280px] bg-white/80 backdrop-blur shadow overflow-y-auto'
className='flex flex-col relative z-10 h-full min-w-[280px] bg-white/80 backdrop-blur shadow overflow-y-auto'
ref={el}
>
<button
Expand Down
61 changes: 60 additions & 1 deletion packages/storybook/src/core-data/PlaceDetailsPanel.stories.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
// @flow

import { action } from '@storybook/addon-actions';
import React from 'react';
import React, { useState } from 'react';
import PlaceDetailsPanel from '../../../core-data/src/components/PlaceDetailsPanel';
import place from '../data/Place.json';
import relatedMedia from '../data/RelatedMedia.json';
import relatedPlaces from '../data/RelatedPlaces.json';
import { Button, Modal, Sidebar } from 'semantic-ui-react';

export default {
title: 'Components/Core Data/PlaceDetailsPanel',
Expand All @@ -27,3 +28,61 @@ export const Default = () => (
}]}
/>
);

export const SidebarVersion = () => {
const [visible, setVisible] = useState(false);
return (
<>
<Sidebar
visible={visible}
>
<PlaceDetailsPanel
onClose={() => setVisible(false)}
place={place}
related={[{
endpoint: 'media_contents',
ui_label: 'Related Media',
data: relatedMedia
}, {
endpoint: 'places',
ui_label: 'Related Places',
data: relatedPlaces
}]}
/>
</Sidebar>
<Button onClick={() => setVisible(true)}>
Open Sidebar
</Button>
</>
)
};

export const ModalVersion = () => {
const [open, setOpen] = useState(false);
return (
<>
<Modal
open={open}
>
<Modal.Content>
<PlaceDetailsPanel
onClose={() => setOpen(false)}
place={place}
related={[{
endpoint: 'media_contents',
ui_label: 'Related Media',
data: relatedMedia
}, {
endpoint: 'places',
ui_label: 'Related Places',
data: relatedPlaces
}]}
/>
</Modal.Content>
</Modal>
<Button onClick={() => setOpen(true)}>
Open Modal
</Button>
</>
);
};