-
Notifications
You must be signed in to change notification settings - Fork 1
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
1 parent
71b03bd
commit 20964c3
Showing
14 changed files
with
177 additions
and
101 deletions.
There are no files selected for viewing
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 was deleted.
Oops, something went wrong.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
import LogoBlockEdit from './Logo/Edit'; | ||
import LogoBlockView from './Logo/View'; | ||
import Edit from './Edit'; | ||
|
||
export { LogoBlockEdit, LogoBlockView, Edit }; | ||
export { LogoBlockEdit, LogoBlockView }; |
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
63 changes: 63 additions & 0 deletions
63
packages/volto-logos-block/src/components/widgets/LogoBlockSizeWidget.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,63 @@ | ||
import { defineMessages, useIntl } from 'react-intl'; | ||
import type { IntlShape } from 'react-intl'; | ||
|
||
import ButtonsWidget, { | ||
type ButtonsWidgetProps, | ||
} from '@kitconcept/volto-light-theme/components/Widgets/ButtonsWidget'; | ||
|
||
const messages = defineMessages({ | ||
s: { | ||
id: 'Small', | ||
defaultMessage: 'Small', | ||
}, | ||
l: { | ||
id: 'Large', | ||
defaultMessage: 'Large', | ||
}, | ||
}); | ||
|
||
export const defaultActionsInfo = ({ intl }: { intl: IntlShape }) => ({ | ||
s: ['S', intl.formatMessage(messages.s)], | ||
l: ['L', intl.formatMessage(messages.l)], | ||
}); | ||
|
||
const DEFAULT_ACTIONS = [ | ||
{ | ||
name: 's', | ||
label: 'Small', | ||
}, | ||
{ | ||
name: 'l', | ||
label: 'Large', | ||
}, | ||
]; | ||
|
||
const SizeWidget = (props: ButtonsWidgetProps) => { | ||
const intl = useIntl(); | ||
|
||
const { actions = DEFAULT_ACTIONS, actionsInfoMap, filterActions } = props; | ||
|
||
let filteredActions; | ||
if (filterActions) { | ||
filteredActions = actions.filter((action) => | ||
filterActions.includes(action.name), | ||
); | ||
} else { | ||
filteredActions = actions; | ||
} | ||
|
||
const actionsInfo = { | ||
...defaultActionsInfo({ intl }), | ||
...actionsInfoMap, | ||
}; | ||
|
||
return ( | ||
<ButtonsWidget | ||
{...props} | ||
actions={filteredActions} | ||
actionsInfoMap={actionsInfo} | ||
/> | ||
); | ||
}; | ||
|
||
export default SizeWidget; |
65 changes: 65 additions & 0 deletions
65
packages/volto-logos-block/src/components/widgets/LogoBlockWidthWidget.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,65 @@ | ||
import React from 'react'; | ||
import { defineMessages, useIntl } from 'react-intl'; | ||
import type { IntlShape } from 'react-intl'; | ||
|
||
import ButtonsWidget, { | ||
type ButtonsWidgetProps, | ||
} from '@kitconcept/volto-light-theme/components/Widgets/ButtonsWidget'; | ||
import imageFitSVG from '@plone/volto/icons/image-fit.svg'; | ||
import imageWideSVG from '@plone/volto/icons/image-wide.svg'; | ||
|
||
const messages = defineMessages({ | ||
default: { | ||
id: 'Default', | ||
defaultMessage: 'Default', | ||
}, | ||
layout: { | ||
id: 'Layout', | ||
defaultMessage: 'Layout', | ||
}, | ||
}); | ||
|
||
export const defaultActionsInfo = ({ intl }: { intl: IntlShape }) => ({ | ||
default: [imageFitSVG, intl.formatMessage(messages.default)], | ||
layout: [imageWideSVG, intl.formatMessage(messages.layout)], | ||
}); | ||
|
||
const DEFAULT_ACTIONS = [ | ||
{ | ||
name: 'default', | ||
label: 'Default', | ||
}, | ||
{ | ||
name: 'layout', | ||
label: 'Layout', | ||
}, | ||
]; | ||
|
||
const LogoBlockWidthWidget = (props: ButtonsWidgetProps) => { | ||
const intl = useIntl(); | ||
|
||
const { actions = DEFAULT_ACTIONS, actionsInfoMap, filterActions } = props; | ||
let filteredActions; | ||
if (filterActions) { | ||
filteredActions = actions.filter((action) => | ||
filterActions.includes(action.name), | ||
); | ||
} else { | ||
filteredActions = actions; | ||
} | ||
|
||
const actionsInfo = { | ||
...defaultActionsInfo({ intl }), | ||
...actionsInfoMap, | ||
}; | ||
|
||
return ( | ||
<ButtonsWidget | ||
{...props} | ||
actions={filteredActions} | ||
actionsInfoMap={actionsInfo} | ||
/> | ||
); | ||
}; | ||
|
||
export default LogoBlockWidthWidget; |
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,3 +1,5 @@ | ||
import BlocksObjectWidget from './BlocksObjectWidget'; | ||
import LogoBlockSizeWidget from './LogoBlockSizeWidget'; | ||
import LogoBlockWidthWidget from './LogoBlockWidthWidget'; | ||
|
||
export { BlocksObjectWidget }; | ||
export { BlocksObjectWidget, LogoBlockSizeWidget, LogoBlockWidthWidget }; |
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 was deleted.
Oops, something went wrong.
Oops, something went wrong.