aboutsummaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorJeremy Davis <jeremy.davis@sonarsource.com>2023-07-17 13:55:19 +0200
committersonartech <sonartech@sonarsource.com>2023-07-21 20:03:16 +0000
commit106e5141332a4d11dd055941394d4a8b4bc83f10 (patch)
tree004522058b9b25fd1055641409c5454a9758d9c3 /server
parent8f2fde029e993cedf209a9fd7bd50f39dba34a79 (diff)
downloadsonarqube-106e5141332a4d11dd055941394d4a8b4bc83f10.tar.gz
sonarqube-106e5141332a4d11dd055941394d4a8b4bc83f10.zip
SONAR-19936 New UnorderedList components
Diffstat (limited to 'server')
-rw-r--r--server/sonar-web/design-system/src/components/UnorderedList.tsx34
-rw-r--r--server/sonar-web/design-system/src/components/UnorderedListItem.tsx28
-rw-r--r--server/sonar-web/design-system/src/components/__tests__/UnorderedList-test.tsx33
3 files changed, 95 insertions, 0 deletions
diff --git a/server/sonar-web/design-system/src/components/UnorderedList.tsx b/server/sonar-web/design-system/src/components/UnorderedList.tsx
new file mode 100644
index 00000000000..b63f1e322b1
--- /dev/null
+++ b/server/sonar-web/design-system/src/components/UnorderedList.tsx
@@ -0,0 +1,34 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2023 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+import styled from '@emotion/styled';
+import tw from 'twin.macro';
+
+export const UnorderedList = styled.ul`
+ list-style: none;
+ ${tw`sw-mt-4`}
+ ${tw`sw-pl-0`}
+
+ li:last-child {
+ ${tw`sw-mb-0`}
+ }
+`;
+
+UnorderedList.displayName = 'UnorderedList';
diff --git a/server/sonar-web/design-system/src/components/UnorderedListItem.tsx b/server/sonar-web/design-system/src/components/UnorderedListItem.tsx
new file mode 100644
index 00000000000..21d7348a574
--- /dev/null
+++ b/server/sonar-web/design-system/src/components/UnorderedListItem.tsx
@@ -0,0 +1,28 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2023 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+import styled from '@emotion/styled';
+import tw from 'twin.macro';
+
+export const UnorderedListItem = styled.li`
+ ${tw`sw-my-3`}
+`;
+
+UnorderedListItem.displayName = 'UnorderedListItem';
diff --git a/server/sonar-web/design-system/src/components/__tests__/UnorderedList-test.tsx b/server/sonar-web/design-system/src/components/__tests__/UnorderedList-test.tsx
new file mode 100644
index 00000000000..515e39e42ef
--- /dev/null
+++ b/server/sonar-web/design-system/src/components/__tests__/UnorderedList-test.tsx
@@ -0,0 +1,33 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2023 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+import { screen } from '@testing-library/react';
+import { render } from '../../helpers/testUtils';
+import { UnorderedList } from '../UnorderedList';
+import { UnorderedListItem } from '../UnorderedListItem';
+
+it('renders correctly', () => {
+ render(
+ <UnorderedList>
+ <UnorderedListItem>First item</UnorderedListItem>
+ <UnorderedListItem>Second item</UnorderedListItem>
+ </UnorderedList>
+ );
+ expect(screen.getAllByRole('listitem')).toHaveLength(2);
+});