Skip to content

Commit

Permalink
storybook clean up code
Browse files Browse the repository at this point in the history
  • Loading branch information
g-stamatis committed Dec 22, 2021
1 parent 0bf4083 commit bffd326
Show file tree
Hide file tree
Showing 19 changed files with 21 additions and 58 deletions.
4 changes: 0 additions & 4 deletions src/customizations/components/theme/Accordion/Accordion.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
import React, { useState } from 'react';
import { Accordion, Icon } from 'semantic-ui-react';

import PropTypes from 'prop-types';

export function AccordionEEA({ content, variant, ...args }) {
const [activeIndex, setActiveIndex] = useState(0);

const toggleOpenAccordion = (e, titleProps) => {
const { index } = titleProps;
const { activeIndex2 } = activeIndex;
const newIndex = activeIndex2 === index ? -1 : index;

setActiveIndex(index);
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { injectIntl } from 'react-intl';
import { React, useState } from 'react';
import { Accordion } from 'semantic-ui-react';
import { React } from 'react';
import { AccordionEEA } from './Accordion';

export default {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { injectIntl } from 'react-intl';
import React from 'react';
import { Button, Icon } from 'semantic-ui-react';

Expand Down
3 changes: 1 addition & 2 deletions src/customizations/components/theme/Card/Card.stories.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { injectIntl } from 'react-intl';
import React from 'react';
import { Card, Icon, Image } from 'semantic-ui-react';
import { Card, Image } from 'semantic-ui-react';

export default {
title: 'Components/Card',
Expand Down
2 changes: 1 addition & 1 deletion src/customizations/components/theme/Comment/Comment.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { Button, Comment, Form, Header } from 'semantic-ui-react';
import { Comment, Header } from 'semantic-ui-react';

function CommentEEA({ title, comments, threaded, minimal, size }) {
return (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from 'react';
import CommentEEA from './Comment';
import { Icon } from 'semantic-ui-react';

export default {
title: 'Components/Comment',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { Component, useState } from 'react';
import React, { useState } from 'react';
import { Button, Confirm } from 'semantic-ui-react';

export default {
Expand Down
3 changes: 1 addition & 2 deletions src/customizations/components/theme/Form/Checkbox.stories.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { injectIntl } from 'react-intl';
import React from 'react';
import { Button, Checkbox, Form } from 'semantic-ui-react';
import { Checkbox } from 'semantic-ui-react';

export default {
title: 'Components/Forms/Checkbox',
Expand Down
2 changes: 0 additions & 2 deletions src/customizations/components/theme/Header/Header.stories.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { injectIntl } from 'react-intl';
import React from 'react';
import { Input } from 'semantic-ui-react';
import { Header } from '@plone/volto/components';
import { Segment } from 'semantic-ui-react';
import Wrapper from '@plone/volto/storybook';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,6 @@ export default {
},
};

function HeaderContent({ content, size, icon, textAlign }) {
return (
<Header size={size} icon={icon} textAlign={textAlign}>
{icon && <Icon name="users" circular />}
<Header.Content>{content}</Header.Content>
</Header>
);
}

const Template = (args) => <Header {...args}></Header>;

export const Default = Template.bind({});
Expand Down
3 changes: 1 addition & 2 deletions src/customizations/components/theme/Input/Input.stories.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { injectIntl } from 'react-intl';
import React from 'react';
import { Input, Form } from 'semantic-ui-react';
import { Input } from 'semantic-ui-react';

export default {
title: 'Components/Forms/Input',
Expand Down
2 changes: 1 addition & 1 deletion src/customizations/components/theme/Label/Label.stories.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { Icon, Label, Form, Input } from 'semantic-ui-react';
import {Label} from 'semantic-ui-react';

export default {
title: 'Components/Label',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { injectIntl } from 'react-intl';
import React from 'react';
import { List } from 'semantic-ui-react';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { injectIntl } from 'react-intl';
import React from 'react';
import { List } from 'semantic-ui-react';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { injectIntl } from 'react-intl';
import React from 'react';
import { List } from 'semantic-ui-react';

Expand Down
11 changes: 2 additions & 9 deletions src/customizations/components/theme/Menu/Menu.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,7 @@ export default {
argTypes: {},
};

function MenuContent({
items,
secondary,
pointing,
tabular,
text,
vertical,
}) {
function MenuContent({ items, secondary, pointing, tabular, text, vertical }) {
const [activeItem, setActiveItem] = useState(
items.find((item) => item.active === true).key,
);
Expand All @@ -40,7 +33,7 @@ export default {
<Menu.Item
key={index}
name={item.key}
active={activeItem == item.key}
active={activeItem === item.key}
onClick={handleItemClick}
>
{item.name}
Expand Down
4 changes: 2 additions & 2 deletions src/customizations/components/theme/Modal/Modal.stories.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { Button, Header, Icon, Modal } from 'semantic-ui-react';
import { Button, Modal } from 'semantic-ui-react';

export default {
title: 'Components/Modal',
Expand All @@ -11,7 +11,7 @@ export default {
},
dimmer: {
control: { type: 'select' },
options: [, true, 'inverted', 'blurring'],
options: [true, 'inverted', 'blurring'],
},
},
};
Expand Down
12 changes: 2 additions & 10 deletions src/customizations/components/theme/Radio/Radio.stories.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useState } from 'react';
import { Radio, Form } from 'semantic-ui-react';
import React from 'react';
import { Radio } from 'semantic-ui-react';

export default {
title: 'Components/Forms/Radio',
Expand All @@ -10,14 +10,6 @@ export default {
},
},
argtypes: {},
// decorators: [
// (Story) => (
// <Form>
// <Form.Field><Story /></Form.Field>
// <Form.Field><Story /></Form.Field>
// </Form>
// ),
// ],
};

const Template = (args) => <Radio {...args}></Radio>;
Expand Down
13 changes: 8 additions & 5 deletions src/customizations/components/theme/Table/Table.stories.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { injectIntl } from 'react-intl';
import React from 'react';
import { Table } from 'semantic-ui-react';

Expand Down Expand Up @@ -47,18 +46,22 @@ function TableContent(
stackable={stackable}
>
<Table.Header>
<Table.Row textAlign='center'>
<Table.Row textAlign="center">
{headers.map((item, index) => (
<Table.HeaderCell key={index} textAlign='center'>
<Table.HeaderCell key={index} textAlign="center">
{item}
</Table.HeaderCell>
))}
</Table.Row>
</Table.Header>

<Table.Body>
{rows.map((item,rowIndex) => (
<Table.Row textAlign={textAlign} verticalAlign={verticalAlign} key={rowIndex}>
{rows.map((item, rowIndex) => (
<Table.Row
textAlign={textAlign}
verticalAlign={verticalAlign}
key={rowIndex}
>
{item.content.map((cell, cellIndex) => (
<Table.Cell
key={cellIndex}
Expand Down

0 comments on commit bffd326

Please sign in to comment.