-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
126 additions
and
12 deletions.
There are no files selected for viewing
10 changes: 7 additions & 3 deletions
10
packages/design-system/src/lib/components/dropdown-button/dropdown-header/DropdownHeader.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,10 @@ | ||
import { PropsWithChildren } from 'react' | ||
import { Dropdown } from 'react-bootstrap' | ||
|
||
export function DropdownHeader({ children }: PropsWithChildren) { | ||
return <Dropdown.Header>{children}</Dropdown.Header> | ||
interface DropdownHeaderProps { | ||
className?: string | ||
children: React.ReactNode | ||
} | ||
|
||
export function DropdownHeader({ className, children }: DropdownHeaderProps) { | ||
return <Dropdown.Header className={className}>{children}</Dropdown.Header> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
src/sections/collection/edit-collection-dropdown/EditCollectionDropdown.module.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
@import 'node_modules/@iqss/dataverse-design-system/src/lib/assets/styles/design-tokens/colors.module'; | ||
|
||
.dropdown-icon { | ||
margin-right: 0.3rem; | ||
margin-bottom: 0.2rem; | ||
} | ||
|
||
.dropdown-header { | ||
display: flex; | ||
gap: 12px; | ||
align-items: center; | ||
color: unset; | ||
|
||
.collection-alias, | ||
.collection-name { | ||
margin: 0; | ||
} | ||
|
||
.collection-name { | ||
font-weight: 600; | ||
|
||
span { | ||
color: $dv-subtext-color; | ||
font-weight: 400; | ||
} | ||
} | ||
|
||
.collection-alias { | ||
color: $dv-subtext-color; | ||
} | ||
|
||
.collection-icon { | ||
height: fit-content; | ||
color: $dv-collection-border-color; | ||
|
||
> span { | ||
margin-right: 0; | ||
font-size: 40px; | ||
line-height: 1; | ||
} | ||
} | ||
} |
54 changes: 54 additions & 0 deletions
54
src/sections/collection/edit-collection-dropdown/EditCollectionDropdown.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { useNavigate } from 'react-router-dom' | ||
import { useTranslation } from 'react-i18next' | ||
import { | ||
DropdownButton, | ||
DropdownButtonItem, | ||
DropdownHeader, | ||
DropdownSeparator, | ||
Icon, | ||
IconName | ||
} from '@iqss/dataverse-design-system' | ||
import { PencilFill } from 'react-bootstrap-icons' | ||
import { Collection } from '@/collection/domain/models/Collection' | ||
import styles from './EditCollectionDropdown.module.scss' | ||
|
||
interface EditCollectionDropdownProps { | ||
collection: Collection | ||
} | ||
|
||
export const EditCollectionDropdown = ({ collection }: EditCollectionDropdownProps) => { | ||
const { t } = useTranslation('collection') | ||
const navigate = useNavigate() | ||
|
||
const onClickEditGeneralInformation = () => { | ||
navigate('edit-general-information') | ||
} | ||
|
||
console.log(collection) | ||
|
||
return ( | ||
<DropdownButton | ||
id="edit-collection-dropdown" | ||
title={t('editCollection.edit')} | ||
asButtonGroup | ||
variant="secondary" | ||
icon={<PencilFill className={styles['dropdown-icon']} />}> | ||
<DropdownHeader className={styles['dropdown-header']}> | ||
<div className={styles['collection-icon']}> | ||
<Icon name={IconName.COLLECTION} /> | ||
</div> | ||
<div> | ||
<p className={styles['collection-name']}> | ||
{collection.name}{' '} | ||
{collection.affiliation ? <span>({collection.affiliation})</span> : null} | ||
</p> | ||
<p className={styles['collection-alias']}>{collection.id}</p> | ||
</div> | ||
</DropdownHeader> | ||
<DropdownSeparator /> | ||
<DropdownButtonItem onClick={onClickEditGeneralInformation}> | ||
{t('editCollection.generalInfo')} | ||
</DropdownButtonItem> | ||
</DropdownButton> | ||
) | ||
} |