Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 32 additions & 8 deletions client/modules/IDE/components/AddToCollectionList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ import {
import getSortedCollections from '../selectors/collections';
import QuickAddList from './QuickAddList';
import { remSize } from '../../../theme';
import Button from '../../../common/Button';
import Overlay from '../../App/components/Overlay';
import CollectionCreate from '../../User/components/CollectionCreate';

export const CollectionAddSketchWrapper = styled.div`
width: ${remSize(600)};
Expand All @@ -36,6 +39,12 @@ const AddToCollectionList = ({ projectId }) => {

const collections = useSelector(getSortedCollections);

const [collectionCreateVisible, setCollectionCreateVisible] = useState(false);

const toggleCollectionCreate = () => {
setCollectionCreateVisible((prevState) => !prevState);
};

// TODO: improve loading state
const loading = useSelector((state) => state.loading);
const [hasLoadedData, setHasLoadedData] = useState(false);
Expand Down Expand Up @@ -75,14 +84,29 @@ const AddToCollectionList = ({ projectId }) => {
};

return (
<CollectionAddSketchWrapper>
<QuickAddWrapper>
<Helmet>
<title>{t('AddToCollectionList.Title')}</title>
</Helmet>
{getContent()}
</QuickAddWrapper>
</CollectionAddSketchWrapper>
<>
<div className="createCollection-button">
<Button onClick={toggleCollectionCreate}>
{t('DashboardView.CreateCollection')}
</Button>
</div>
<CollectionAddSketchWrapper>
<QuickAddWrapper>
<Helmet>
<title>{t('AddToCollectionList.Title')}</title>
</Helmet>
{getContent()}
{collectionCreateVisible && (
<Overlay
title={t('DashboardView.CreateCollectionOverlay')}
closeOverlay={toggleCollectionCreate}
>
<CollectionCreate />
</Overlay>
)}
</QuickAddWrapper>
</CollectionAddSketchWrapper>
</>
);
};

Expand Down
3 changes: 3 additions & 0 deletions client/styles/components/_add-to-collection.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.createCollection-button {
padding: #{24 / $base-font-size}rem;
}
1 change: 1 addition & 0 deletions client/styles/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
@import 'components/collection';
@import 'components/collection-create';
@import 'components/quick-add';
@import 'components/add-to-collection';

@import 'layout/dashboard';
@import 'layout/ide';
Loading