generated from eea/volto-addon-template
-
Notifications
You must be signed in to change notification settings - Fork 8
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
14f9c78
commit 7f745c3
Showing
13 changed files
with
154 additions
and
26 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
export AccordionBlockEdit from './manage/Blocks/Accordion/Edit'; | ||
export AccordionBlockView from './manage/Blocks/Accordion/View'; | ||
export AccordionBlockSchema from './manage/Blocks/Accordion/Schema'; | ||
|
||
export { options } from './manage/Blocks/Accordion/layout'; |
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import React from 'react'; | ||
import { Segment, Card } from 'semantic-ui-react'; | ||
import { Icon } from '@plone/volto/components'; | ||
|
||
export default ({ data, onChange, children, variants }) => { | ||
return ( | ||
<Segment> | ||
<h4>Select Panels:</h4> | ||
<Card.Group centered itemsPerRow={3}> | ||
{variants.map(({ icon, defaultData, title }, index) => ( | ||
<Card key={index} onClick={() => onChange(defaultData)}> | ||
<Card.Content> | ||
<Icon name={icon} size="55" /> | ||
{title ? <p>{title}</p> : ''} | ||
</Card.Content> | ||
</Card> | ||
))} | ||
</Card.Group> | ||
</Segment> | ||
); | ||
}; |
3 changes: 3 additions & 0 deletions
3
src/components/manage/Blocks/Accordion/icons/four-quarter-columns.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
src/components/manage/Blocks/Accordion/icons/one-third-left.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
src/components/manage/Blocks/Accordion/icons/one-third-right.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
src/components/manage/Blocks/Accordion/icons/three-columns.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
src/components/manage/Blocks/Accordion/icons/three-third-columns.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
src/components/manage/Blocks/Accordion/icons/two-half-columns.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,26 @@ | ||
import threeColumnSVG from './icons/three-third-columns.svg'; | ||
import oneColumnSVG from './icons/full-column.svg'; | ||
|
||
export const options = [ | ||
{ | ||
icon: oneColumnSVG, | ||
defaultData: { | ||
count: 1, | ||
}, | ||
title: '1 Panel', | ||
}, | ||
{ | ||
icon: threeColumnSVG, | ||
defaultData: { | ||
count: 3, | ||
}, | ||
title: '3 Panels', | ||
}, | ||
{ | ||
icon: threeColumnSVG, | ||
defaultData: { | ||
count: 5, | ||
}, | ||
title: '5 Panels', | ||
}, | ||
]; |
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,27 @@ | ||
import { v4 as uuid } from 'uuid'; | ||
import { emptyBlocksForm } from '@eeacms/volto-blocks-form/helpers'; | ||
import { settings } from '~/config'; | ||
|
||
export const empty = (count) => { | ||
const blocks = {}; | ||
const items = []; | ||
for (let x = 0; x < count; x++) { | ||
const id = uuid(); | ||
blocks[id] = emptyBlocksForm(); | ||
items.push(id); | ||
} | ||
|
||
return { | ||
blocks, | ||
blocks_layout: { | ||
items, | ||
}, | ||
}; | ||
}; | ||
|
||
export const getColumns = (data) => { | ||
return (data?.blocks_layout?.items || []).map((id) => [ | ||
id, | ||
data.blocks?.[id], | ||
]); | ||
}; |
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