Skip to content

Commit

Permalink
fix: Add space between button inside toolbar
Browse files Browse the repository at this point in the history
  • Loading branch information
cballevre committed Aug 12, 2024
1 parent 77160da commit 4a35eae
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 13 deletions.
8 changes: 5 additions & 3 deletions src/modules/drive/Toolbar/components/AddButton.jsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import React, { useContext } from 'react'

import Button from 'cozy-ui/transpiled/react/Buttons'
import Icon from 'cozy-ui/transpiled/react/Icon'
import PlusIcon from 'cozy-ui/transpiled/react/Icons/Plus'
import Button from 'cozy-ui/transpiled/react/deprecated/Button'
import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n'

import { AddMenuContext } from 'modules/drive/AddMenu/AddMenuProvider'

export const AddButton = () => {
export const AddButton = ({ className }) => {
const { t } = useI18n()
const {
anchorRef,
Expand All @@ -20,9 +21,10 @@ export const AddButton = () => {
return (
<div ref={anchorRef} onClick={isOffline ? handleOfflineClick : undefined}>
<Button
className={className}
onClick={handleToggle}
disabled={isDisabled || isOffline}
icon={PlusIcon}
startIcon={<Icon icon={PlusIcon} />}
label={t('toolbar.menu_add')}
{...a11y}
/>
Expand Down
4 changes: 2 additions & 2 deletions src/modules/drive/Toolbar/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const Toolbar = ({
displayedFolder={displayedFolder}
folderId={folderId}
>
<ShareButton isDisabled={isSharingDisabled} />
<ShareButton isDisabled={isSharingDisabled} className="u-mr-half" />
</InsideRegularFolder>

{hasWriteAccess && (
Expand All @@ -64,7 +64,7 @@ const Toolbar = ({
displayedFolder={displayedFolder}
isSelectionBarVisible={isSelectionBarVisible}
>
<AddButton />
<AddButton className="u-mr-half" />
</AddMenuProvider>
)}

Expand Down
5 changes: 3 additions & 2 deletions src/modules/drive/Toolbar/share/ShareButton.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import cx from 'classnames'
import { useDisplayedFolder } from 'hooks'
import React from 'react'
import { useLocation, useNavigate } from 'react-router-dom'
Expand All @@ -6,7 +7,7 @@ import { ShareButton } from 'cozy-sharing'

import { getPathToShareDisplayedFolder } from 'modules/drive/Toolbar/share/helpers'

const ShareButtonWithProps = ({ isDisabled }) => {
const ShareButtonWithProps = ({ isDisabled, className }) => {
const { displayedFolder } = useDisplayedFolder()
const navigate = useNavigate()
const { pathname } = useLocation()
Expand All @@ -19,7 +20,7 @@ const ShareButtonWithProps = ({ isDisabled }) => {
<ShareButton
docId={displayedFolder.id}
disabled={isDisabled}
className="u-hide--mob"
className={cx('u-hide--mob', className)}
onClick={() => share(displayedFolder)}
/>
)
Expand Down
14 changes: 10 additions & 4 deletions src/modules/public/DownloadButton.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,25 @@ import PropTypes from 'prop-types'
import React from 'react'

import { useClient } from 'cozy-client'
import { Button } from 'cozy-ui/transpiled/react'
import Button from 'cozy-ui/transpiled/react/Buttons'
import Icon from 'cozy-ui/transpiled/react/Icon'
import DownloadIcon from 'cozy-ui/transpiled/react/Icons/Download'
import { useAlert } from 'cozy-ui/transpiled/react/providers/Alert'
import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n'

import { downloadFiles } from 'modules/actions/utils'

const DownloadButton = ({ onDownload, ...props }) => (
<Button onClick={() => onDownload()} icon={DownloadIcon} {...props} />
<Button
onClick={() => onDownload()}
startIcon={<Icon icon={DownloadIcon} />}
{...props}
/>
)

export default DownloadButton

export const DownloadFilesButton = ({ files }) => {
export const DownloadFilesButton = ({ files, className }) => {
const { t } = useI18n()
const client = useClient()
const { showAlert } = useAlert()
Expand All @@ -27,7 +32,8 @@ export const DownloadFilesButton = ({ files }) => {
onDownload={() => {
downloadFiles(client, files, { showAlert, t })
}}
theme="secondary"
variant="secondary"
className={className}
/>
)
}
Expand Down
6 changes: 4 additions & 2 deletions src/modules/public/PublicToolbarByLink.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,10 @@ const PublicToolbarByLink = ({
>
{!isMobile && (
<>
{hasWriteAccess && <AddButton />}
{files.length > 0 && <DownloadFilesButton files={files} />}
{hasWriteAccess && <AddButton className="u-mr-half" />}
{files.length > 0 && (
<DownloadFilesButton files={files} className="u-mr-half" />
)}
</>
)}
{shouldDisplayMoreMenu && (
Expand Down

0 comments on commit 4a35eae

Please sign in to comment.