aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/organisms
diff options
context:
space:
mode:
authorArmand Philippot <git@armandphilippot.com>2022-05-16 19:40:23 +0200
committerArmand Philippot <git@armandphilippot.com>2022-05-16 19:40:23 +0200
commitc77c58e18143233be042c4980a6ed08ae9beac52 (patch)
tree94f7d828571a86470ae299fff7dffd32fb38de7c /src/components/organisms
parent2155550fa36a3bc3c8f66e0926530123b4018cd4 (diff)
chore: adjust and complete missing styles
* add logo to topics pages and links * add Prism styles to articles * and a few other adjustements
Diffstat (limited to 'src/components/organisms')
-rw-r--r--src/components/organisms/forms/comment-form.tsx12
-rw-r--r--src/components/organisms/widgets/sharing.stories.tsx21
-rw-r--r--src/components/organisms/widgets/sharing.tsx7
3 files changed, 23 insertions, 17 deletions
diff --git a/src/components/organisms/forms/comment-form.tsx b/src/components/organisms/forms/comment-form.tsx
index 9e0abdf..5ff4ea4 100644
--- a/src/components/organisms/forms/comment-form.tsx
+++ b/src/components/organisms/forms/comment-form.tsx
@@ -1,5 +1,5 @@
import Button from '@components/atoms/buttons/button';
-import Form from '@components/atoms/forms/form';
+import Form, { type FormProps } from '@components/atoms/forms/form';
import Heading, { type HeadingLevel } from '@components/atoms/headings/heading';
import Spinner from '@components/atoms/loaders/spinner';
import LabelledField from '@components/molecules/forms/labelled-field';
@@ -15,11 +15,7 @@ export type CommentFormData = {
website?: string;
};
-export type CommentFormProps = {
- /**
- * Set additional classnames to the form wrapper.
- */
- className?: string;
+export type CommentFormProps = Pick<FormProps, 'className'> & {
/**
* Pass a component to print a success/error message.
*/
@@ -44,12 +40,12 @@ export type CommentFormProps = {
};
const CommentForm: FC<CommentFormProps> = ({
- className = '',
Notice,
parentId,
saveComment,
title,
titleLevel = 2,
+ ...props
}) => {
const intl = useIntl();
const [name, setName] = useState<string>('');
@@ -116,9 +112,9 @@ const CommentForm: FC<CommentFormProps> = ({
return (
<Form
onSubmit={submitHandler}
- className={className}
aria-label={formAriaLabel}
aria-labelledby={formLabelledBy}
+ {...props}
>
{title && (
<Heading id={formId} level={titleLevel}>
diff --git a/src/components/organisms/widgets/sharing.stories.tsx b/src/components/organisms/widgets/sharing.stories.tsx
index 47213b6..59b86d3 100644
--- a/src/components/organisms/widgets/sharing.stories.tsx
+++ b/src/components/organisms/widgets/sharing.stories.tsx
@@ -1,5 +1,4 @@
import { ComponentMeta, ComponentStory } from '@storybook/react';
-import { IntlProvider } from 'react-intl';
import SharingWidget from './sharing';
/**
@@ -9,6 +8,19 @@ export default {
title: 'Organisms/Widgets',
component: SharingWidget,
argTypes: {
+ className: {
+ control: {
+ type: 'text',
+ },
+ description: 'Set additional classnames to the sharing links list.',
+ table: {
+ category: 'Styles',
+ },
+ type: {
+ name: 'string',
+ required: false,
+ },
+ },
data: {
description: 'The page data.',
type: {
@@ -58,13 +70,6 @@ export default {
},
},
},
- decorators: [
- (Story) => (
- <IntlProvider locale="en">
- <Story />
- </IntlProvider>
- ),
- ],
} as ComponentMeta<typeof SharingWidget>;
const Template: ComponentStory<typeof SharingWidget> = (args) => (
diff --git a/src/components/organisms/widgets/sharing.tsx b/src/components/organisms/widgets/sharing.tsx
index 85dadb0..c63f5db 100644
--- a/src/components/organisms/widgets/sharing.tsx
+++ b/src/components/organisms/widgets/sharing.tsx
@@ -23,6 +23,10 @@ export type SharingData = {
export type SharingProps = {
/**
+ * Set additional classnames to the sharing links list.
+ */
+ className?: string;
+ /**
* The page data to share.
*/
data: SharingData;
@@ -46,6 +50,7 @@ export type SharingProps = {
* Render a list of sharing links inside a widget.
*/
const Sharing: FC<SharingProps> = ({
+ className = '',
data,
media,
expanded = true,
@@ -201,7 +206,7 @@ const Sharing: FC<SharingProps> = ({
return (
<Widget expanded={expanded} level={level} title={widgetTitle} {...props}>
- <ul className={styles.list}>{getItems()}</ul>
+ <ul className={`${styles.list} ${className}`}>{getItems()}</ul>
</Widget>
);
};