diff --git a/packages/fuselage/src/components/Message/MessageOrderedList.tsx b/packages/fuselage/src/components/Message/MessageOrderedList.tsx
deleted file mode 100644
index 9b459844f7..0000000000
--- a/packages/fuselage/src/components/Message/MessageOrderedList.tsx
+++ /dev/null
@@ -1,10 +0,0 @@
-import type { ReactNode } from 'react';
-import React from 'react';
-
-type MessageOrderedListProps = {
- children?: ReactNode;
-};
-
-export const MessageOrderedList = (props: MessageOrderedListProps) => (
-
-);
diff --git a/packages/fuselage/src/components/Message/MessageOrderedListItem.tsx b/packages/fuselage/src/components/Message/MessageOrderedListItem.tsx
deleted file mode 100644
index 354ef5d0c2..0000000000
--- a/packages/fuselage/src/components/Message/MessageOrderedListItem.tsx
+++ /dev/null
@@ -1,14 +0,0 @@
-import type { ReactNode } from 'react';
-import React from 'react';
-
-type MessageOrderedListItemProps = {
- value: number;
- children?: ReactNode;
-};
-
-export const MessageOrderedListItem = (props: MessageOrderedListItemProps) => (
-
-);
diff --git a/packages/fuselage/src/components/Message/MessageUnorderedList.tsx b/packages/fuselage/src/components/Message/MessageUnorderedList.tsx
deleted file mode 100644
index e12647cada..0000000000
--- a/packages/fuselage/src/components/Message/MessageUnorderedList.tsx
+++ /dev/null
@@ -1,10 +0,0 @@
-import type { ReactNode } from 'react';
-import React from 'react';
-
-type MessageUnorderedListProps = {
- children?: ReactNode;
-};
-
-export const MessageUnorderedList = (props: MessageUnorderedListProps) => (
-
-);
diff --git a/packages/fuselage/src/components/Message/MessageUnorderedListItem.tsx b/packages/fuselage/src/components/Message/MessageUnorderedListItem.tsx
deleted file mode 100644
index 8ce017f4c7..0000000000
--- a/packages/fuselage/src/components/Message/MessageUnorderedListItem.tsx
+++ /dev/null
@@ -1,15 +0,0 @@
-import type { ReactNode } from 'react';
-import React from 'react';
-
-type MessageUnorderedListItemProps = {
- children?: ReactNode;
-};
-
-export const MessageUnorderedListItem = (
- props: MessageUnorderedListItemProps
-) => (
-
-);
diff --git a/packages/fuselage/src/components/Message/Messages.stories.tsx b/packages/fuselage/src/components/Message/Messages.stories.tsx
index 609a5fb225..7883950279 100644
--- a/packages/fuselage/src/components/Message/Messages.stories.tsx
+++ b/packages/fuselage/src/components/Message/Messages.stories.tsx
@@ -439,17 +439,11 @@ export const MessageUnorderedList = () => (
Unordered list:
-
-
- Ut enim ad minim
-
-
- Incididunt ut labore
-
-
- Labore et dolore
-
-
+
+ - Ut enim ad minim
+ - Incididunt ut labore
+ - Labore et dolore
+
@@ -487,17 +481,11 @@ export const MessageOrderedList = () => (
Ordered list:
-
-
- Ut enim ad minim
-
-
- Incididunt ut labore
-
-
- Labore et dolore
-
-
+
+ - Ut enim ad minim
+ - Incididunt ut labore
+ - Labore et dolore
+
diff --git a/packages/fuselage/src/components/Message/Messages.styles.scss b/packages/fuselage/src/components/Message/Messages.styles.scss
index 1033c60aab..d7075ae03e 100644
--- a/packages/fuselage/src/components/Message/Messages.styles.scss
+++ b/packages/fuselage/src/components/Message/Messages.styles.scss
@@ -207,36 +207,30 @@ $message-background-color-highlight: functions.theme(
}
}
- &-unordered-list {
- padding-top: lengths.padding(4);
+ & ul,
+ ol {
+ margin: 0;
+ padding-block-start: lengths.padding(4);
+ padding-block-end: 0;
+ padding-inline: 0;
list-style: none;
+ }
- &__item {
- &::before {
- padding: 0 lengths.padding(8);
+ & ul li::before {
+ padding: 0 lengths.padding(8);
- content: '•';
+ content: '•';
- font-weight: bold;
- }
- }
+ font-weight: bold;
}
- &-ordered-list {
- padding-top: lengths.padding(4);
+ & ol li::before {
+ padding: 0 lengths.padding(8);
- list-style: none;
+ content: attr(value) '.';
- &__item {
- &::before {
- padding: 0 lengths.padding(8);
-
- content: attr(value) '.';
-
- font-weight: bold;
- }
- }
+ font-weight: bold;
}
&__emoji {
diff --git a/packages/fuselage/src/components/Message/index.tsx b/packages/fuselage/src/components/Message/index.tsx
index ee32b91298..aad2bb7adb 100644
--- a/packages/fuselage/src/components/Message/index.tsx
+++ b/packages/fuselage/src/components/Message/index.tsx
@@ -8,14 +8,10 @@ import { MessageHeader } from './MessageHeader';
import { MessageLeftContainer } from './MessageLeftContainer';
import MessageMetrics from './MessageMetrics';
import { MessageName } from './MessageName';
-import { MessageOrderedList } from './MessageOrderedList';
-import { MessageOrderedListItem } from './MessageOrderedListItem';
import { MessageRole } from './MessageRole';
import { MessageRoles } from './MessageRoles';
import { MessageTimestamp } from './MessageTimestamp';
import MessageToolbox from './MessageToolbox';
-import { MessageUnorderedList } from './MessageUnorderedList';
-import { MessageUnorderedListItem } from './MessageUnorderedListItem';
import { MessageUsername } from './MessageUsername';
export * from './MessageDivider';
@@ -38,10 +34,6 @@ export * from './MessageRoles';
export * from './MessageTimestamp';
export * from './MessageUsername';
export * from './MessageEmoji';
-export * from './MessageUnorderedList';
-export * from './MessageUnorderedListItem';
-export * from './MessageOrderedList';
-export * from './MessageOrderedListItem';
export default Object.assign(Message, {
Metrics: MessageMetrics,
@@ -52,10 +44,6 @@ export default Object.assign(Message, {
Header: MessageHeader,
Body: MessageBody,
Block: MessageBlock,
- OrderedList: MessageOrderedList,
- OrderedListItem: MessageOrderedListItem,
- UnorderedList: MessageUnorderedList,
- UnorderedListItem: MessageUnorderedListItem,
Timestamp: MessageTimestamp,
Name: MessageName,
Username: MessageUsername,
diff --git a/packages/message-parser/src/definitions.ts b/packages/message-parser/src/definitions.ts
index 49b1800647..cecea53891 100644
--- a/packages/message-parser/src/definitions.ts
+++ b/packages/message-parser/src/definitions.ts
@@ -5,7 +5,7 @@ export type Blockquote = {
export type OrderedList = {
type: 'ORDERED_LIST';
- value: OrderedListItem[];
+ value: ListItem[];
};
export type UnorderedList = {
@@ -16,11 +16,7 @@ export type UnorderedList = {
export type ListItem = {
type: 'LIST_ITEM';
value: Inlines[];
-};
-
-export type OrderedListItem = {
- type: 'ORDERED_LIST_ITEM';
- value: { digit: string; text: Inlines[] };
+ number?: number;
};
export type Tasks = {
@@ -160,7 +156,6 @@ export type Types = {
TASK: Task;
UNORDERED_LIST: UnorderedList;
ORDERED_LIST: OrderedList;
- ORDERED_LIST_ITEM: OrderedListItem;
LIST_ITEM: ListItem;
IMAGE: Image;
LINE_BREAK: LineBreak;
diff --git a/packages/message-parser/src/grammar.pegjs b/packages/message-parser/src/grammar.pegjs
index 94edb9cd54..c5b037741d 100644
--- a/packages/message-parser/src/grammar.pegjs
+++ b/packages/message-parser/src/grammar.pegjs
@@ -22,7 +22,6 @@
task,
orderedList,
listItem,
- orderedListItem,
unorderedList,
lineBreak,
} = require('./utils');
@@ -275,10 +274,10 @@ UnorderedList_ = lists:UnorderedListItem_+ { return unorderedList(lists); }
UnorderedList__ = lists:UnorderedListItem__+ { return unorderedList(lists); }
-UnorderedListItem_ = "- " text:Inline { return listItem(text, true); }
+UnorderedListItem_ = "- " text:Inline { return listItem(text); }
UnorderedListItem__
- = "* " text:UnorderedListItem__Inline { return listItem(text, true); }
+ = "* " text:UnorderedListItem__Inline { return listItem(text); }
UnorderedListItem__Inline
= value:(
@@ -300,8 +299,7 @@ UnorderedListItem__Inline
OrderedList = lists:OrderedListItem+ { return orderedList(lists); }
-OrderedListItem
- = d:digits "\x2E " text:Inline { return orderedListItem(d, text); }
+OrderedListItem = d:digits "\x2E " text:Inline { return listItem(text, d); }
Codetype = t:[a-zA-Z0-9 \_\-.]+ { return t.join(''); }
diff --git a/packages/message-parser/src/utils.ts b/packages/message-parser/src/utils.ts
index a9f84d7b51..f2d5108a9d 100644
--- a/packages/message-parser/src/utils.ts
+++ b/packages/message-parser/src/utils.ts
@@ -7,6 +7,7 @@ import type {
Paragraph,
Types,
Task,
+ ListItem,
Inlines,
} from './definitions';
@@ -85,12 +86,11 @@ export const orderedList = generate('ORDERED_LIST');
export const unorderedList = generate('UNORDERED_LIST');
-export const listItem = generate('LIST_ITEM');
-
-export const orderedListItem = (() => {
- const fn = generate('ORDERED_LIST_ITEM');
- return (digit: string, text: Inlines[]) => fn({ digit, text });
-})();
+export const listItem = (text: Inlines[], number?: string): ListItem => ({
+ type: 'LIST_ITEM',
+ value: text,
+ ...(number && { number: Number(number) }),
+});
export const mentionUser = (() => {
const fn = generate('MENTION_USER');
diff --git a/packages/message-parser/tests/orderedList.test.ts b/packages/message-parser/tests/orderedList.test.ts
index 42be3e2b71..70fc5ac9f7 100644
--- a/packages/message-parser/tests/orderedList.test.ts
+++ b/packages/message-parser/tests/orderedList.test.ts
@@ -1,5 +1,5 @@
import { parser } from '../src';
-import { bold, plain, orderedList, orderedListItem } from '../src/utils';
+import { bold, plain, orderedList, listItem } from '../src/utils';
test.each([
[
@@ -12,11 +12,11 @@ test.each([
`.trim(),
[
orderedList([
- orderedListItem('7', [plain('First item')]),
- orderedListItem('2', [plain('Second item')]),
- orderedListItem('8', [plain('Third item')]),
- orderedListItem('4', [bold([plain('Fourth item')])]),
- orderedListItem('15', [bold([plain('Fifteenth item')])]),
+ listItem([plain('First item')], '7'),
+ listItem([plain('Second item')], '2'),
+ listItem([plain('Third item')], '8'),
+ listItem([bold([plain('Fourth item')])], '4'),
+ listItem([bold([plain('Fifteenth item')])], '15'),
]),
],
],