@scm-manager/ui-components 4.0.0-REACT18-20250701-125025 → 4.0.0-REACT18-20250824-143504
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +45 -50
- package/src/BranchSelector.stories.tsx +60 -11
- package/src/Breadcrumb.stories.tsx +131 -57
- package/src/Breadcrumb.tsx +3 -3
- package/src/CardColumn.stories.tsx +94 -27
- package/src/CardColumnSmall.stories.tsx +102 -27
- package/src/CommaSeparatedList.tsx +2 -2
- package/src/Date.stories.tsx +64 -17
- package/src/Duration.stories.tsx +92 -45
- package/src/ErrorBoundary.tsx +38 -58
- package/src/ErrorNotification.tsx +1 -1
- package/src/Help.stories.tsx +61 -17
- package/src/Help.tsx +5 -11
- package/src/Icon.stories.tsx +93 -13
- package/src/LinkPaginator.tsx +9 -6
- package/src/Loading.stories.tsx +26 -6
- package/src/Logo.stories.tsx +44 -13
- package/src/Notification.stories.tsx +111 -23
- package/src/OverviewPageActions.tsx +5 -5
- package/src/Paginator.test.tsx +115 -94
- package/src/PdfViewer.stories.tsx +83 -5
- package/src/PreformattedCodeBlock.stories.tsx +97 -26
- package/src/ProtectedRoute.tsx +14 -39
- package/src/SmallLoadingSpinner.stories.tsx +26 -6
- package/src/SyntaxHighlighter.stories.tsx +122 -40
- package/src/SyntaxHighlighterRenderer.tsx +7 -7
- package/src/Tag.stories.tsx +135 -18
- package/src/Tag.tsx +2 -1
- package/src/Tooltip.stories.tsx +147 -34
- package/src/__snapshots__/storyshots.test.ts.snap +6 -112
- package/src/avatar/Avatar.ts +1 -1
- package/src/avatar/AvatarImage.tsx +1 -1
- package/src/avatar/AvatarWrapper.tsx +2 -2
- package/src/buttons/Button.stories.tsx +159 -0
- package/src/buttons/Button.tsx +5 -5
- package/src/config/ConfigurationBinder.tsx +39 -39
- package/src/config/ConfigurationForm.tsx +2 -1
- package/src/config/TitledSettings.tsx +4 -1
- package/src/forms/AddKeyValueEntryToTableField.stories.tsx +60 -25
- package/src/forms/Checkbox.stories.tsx +165 -27
- package/src/forms/Checkbox.tsx +1 -0
- package/src/forms/DropDown.stories.tsx +81 -35
- package/src/forms/FileInput.stories.tsx +85 -10
- package/src/forms/InputField.stories.tsx +210 -37
- package/src/forms/InputField.tsx +1 -0
- package/src/forms/Radio.stories.tsx +181 -34
- package/src/forms/Radio.tsx +1 -0
- package/src/forms/Select.stories.tsx +266 -46
- package/src/forms/Select.tsx +1 -0
- package/src/forms/Textarea.stories.tsx +99 -53
- package/src/forms/Textarea.tsx +1 -0
- package/src/forms/index.ts +3 -1
- package/src/index.ts +5 -5
- package/src/jest-dom.d.ts +17 -0
- package/src/layout/Footer.stories.tsx +114 -22
- package/src/layout/FooterSection.tsx +1 -0
- package/src/layout/Header.tsx +2 -1
- package/src/layout/Page.tsx +1 -3
- package/src/layout/PrimaryContentColumn.tsx +2 -2
- package/src/layout/SecondaryNavigationColumn.tsx +3 -3
- package/src/layout/SubSubtitle.tsx +2 -1
- package/src/layout/Subtitle.tsx +2 -1
- package/src/layout/Title.tsx +2 -5
- package/src/markdown/LazyMarkdownView.tsx +16 -5
- package/src/markdown/MarkdownHeadingRenderer.test.ts +9 -1
- package/src/markdown/MarkdownHeadingRenderer.tsx +3 -3
- package/src/markdown/MarkdownImageRenderer.test.ts +8 -1
- package/src/markdown/MarkdownImageRenderer.tsx +2 -1
- package/src/markdown/MarkdownLinkRenderer.test.tsx +9 -0
- package/src/markdown/MarkdownLinkRenderer.tsx +6 -4
- package/src/markdown/MarkdownView.stories.tsx +224 -72
- package/src/markdown/markdownExtensions.ts +6 -4
- package/src/modals/ConfirmAlert.stories.tsx +133 -44
- package/src/modals/ConfirmAlert.tsx +5 -4
- package/src/modals/Modal.stories.tsx +461 -252
- package/src/modals/Modal.tsx +12 -11
- package/src/modals/useRegisterModal.test.tsx +5 -4
- package/src/navigation/MenuContext.tsx +2 -2
- package/src/navigation/NavLink.tsx +4 -7
- package/src/navigation/PrimaryNavigation.tsx +2 -2
- package/src/navigation/PrimaryNavigationLink.tsx +6 -5
- package/src/navigation/RoutingProps.ts +1 -3
- package/src/navigation/SecondaryNavigation.stories.tsx +157 -45
- package/src/navigation/SecondaryNavigation.tsx +17 -16
- package/src/navigation/SecondaryNavigationItem.tsx +2 -1
- package/src/navigation/SubNavigation.tsx +4 -8
- package/src/navigation/useActiveMatch.ts +20 -22
- package/src/navigation/useNavigationLock.ts +1 -0
- package/src/popover/Popover.stories.tsx +111 -41
- package/src/popover/Popover.tsx +2 -5
- package/src/repos/Diff.stories.tsx +418 -223
- package/src/repos/Diff.tsx +1 -5
- package/src/repos/HunkExpandDivider.tsx +2 -2
- package/src/repos/LoadingDiff.tsx +11 -6
- package/src/repos/RepositoryEntry.stories.tsx +217 -53
- package/src/repos/RepositoryFlag.tsx +2 -1
- package/src/repos/TokenizedDiffView.tsx +4 -2
- package/src/repos/annotate/Annotate.stories.tsx +225 -111
- package/src/repos/annotate/AnnotateLine.tsx +2 -1
- package/src/repos/changesets/ChangesetAuthor.tsx +2 -2
- package/src/repos/changesets/ChangesetButtonGroup.test.tsx +9 -5
- package/src/repos/changesets/ChangesetDiff.test.ts +10 -2
- package/src/repos/changesets/Changesets.stories.tsx +388 -197
- package/src/repos/changesets/ContributorRow.tsx +2 -2
- package/src/repos/changesets/SignatureIcon.tsx +1 -0
- package/src/repos/diff/DiffFileTree.tsx +1 -1
- package/src/repos/diff/styledElements.tsx +4 -3
- package/src/repos/index.ts +15 -15
- package/src/search/Hit.tsx +3 -2
- package/src/search/TextHitField.stories.tsx +131 -43
- package/src/search/TextHitField.tsx +3 -2
- package/src/search/index.ts +1 -1
- package/src/storyshots.test.ts +66 -60
- package/src/table/Table.stories.tsx +146 -48
- package/src/table/Table.tsx +7 -8
- package/src/table/TextColumn.tsx +0 -9
- package/src/toast/Toast.tsx +2 -1
- package/src/toast/ToastArea.tsx +2 -2
- package/src/toast/ToastButton.tsx +2 -1
- package/src/toast/ToastButtons.tsx +4 -2
- package/src/toast/ToastNotification.tsx +2 -1
- package/src/toast/index.stories.tsx +144 -39
- package/src/toast/index.ts +1 -1
- package/src/buttons/index.stories.tsx +0 -85
package/src/repos/Diff.tsx
CHANGED
|
@@ -19,7 +19,7 @@ import DiffFile from "./DiffFile";
|
|
|
19
19
|
import { DiffObjectProps, FileControlFactory } from "./DiffTypes";
|
|
20
20
|
import { FileDiff } from "@scm-manager/ui-types";
|
|
21
21
|
import { getAnchorSelector, getFileNameFromHash } from "./diffs";
|
|
22
|
-
import Notification from "
|
|
22
|
+
import { Notification } from "@scm-manager/ui-core";
|
|
23
23
|
import { useTranslation } from "react-i18next";
|
|
24
24
|
import { useLocation } from "react-router-dom";
|
|
25
25
|
import { useScrollToElementWithCallback } from "../useScrollToElement";
|
|
@@ -119,8 +119,4 @@ const Diff: FC<Props> = ({
|
|
|
119
119
|
);
|
|
120
120
|
};
|
|
121
121
|
|
|
122
|
-
Diff.defaultProps = {
|
|
123
|
-
sideBySide: false,
|
|
124
|
-
};
|
|
125
|
-
|
|
126
122
|
export default Diff;
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* along with this program. If not, see https://www.gnu.org/licenses/.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import React, { FC } from "react";
|
|
17
|
+
import React, { FC, ReactNode } from "react";
|
|
18
18
|
// @ts-ignore
|
|
19
19
|
import { Decoration } from "react-diff-view";
|
|
20
20
|
import styled from "styled-components";
|
|
@@ -26,7 +26,7 @@ const HunkDivider = styled.div`
|
|
|
26
26
|
} ;
|
|
27
27
|
`;
|
|
28
28
|
|
|
29
|
-
const HunkExpandDivider: FC = ({ children }) => {
|
|
29
|
+
const HunkExpandDivider: FC<{ children: ReactNode }> = ({ children }) => {
|
|
30
30
|
return (
|
|
31
31
|
<Decoration>
|
|
32
32
|
<HunkDivider className="is-size-7 pl-5">{children}</HunkDivider>
|
|
@@ -47,6 +47,9 @@ type NotificationProps = {
|
|
|
47
47
|
isFetchingNextPage: boolean;
|
|
48
48
|
};
|
|
49
49
|
|
|
50
|
+
const DEFAULT_LIMIT = 25;
|
|
51
|
+
const DEFAULT_REFETCH_ON_WINDOW_FOCUS = true;
|
|
52
|
+
|
|
50
53
|
const PartialNotification: FC<NotificationProps> = ({ fetchNextPage, isFetchingNextPage }) => {
|
|
51
54
|
const [t] = useTranslation("repos");
|
|
52
55
|
|
|
@@ -61,6 +64,13 @@ const PartialNotification: FC<NotificationProps> = ({ fetchNextPage, isFetchingN
|
|
|
61
64
|
};
|
|
62
65
|
|
|
63
66
|
const LoadingDiff: FC<Props> = ({ url, limit, refetchOnWindowFocus, ...props }) => {
|
|
67
|
+
if (limit == undefined) {
|
|
68
|
+
limit = DEFAULT_LIMIT;
|
|
69
|
+
}
|
|
70
|
+
if (refetchOnWindowFocus == undefined) {
|
|
71
|
+
refetchOnWindowFocus = DEFAULT_REFETCH_ON_WINDOW_FOCUS;
|
|
72
|
+
}
|
|
73
|
+
|
|
64
74
|
const [ignoreWhitespace, setIgnoreWhitespace] = useState<WhitespaceMode>("NONE");
|
|
65
75
|
const [layout, setLayout] = useLayoutState();
|
|
66
76
|
const [collapsed, setCollapsed] = useState(false);
|
|
@@ -150,12 +160,7 @@ const LoadingDiff: FC<Props> = ({ url, limit, refetchOnWindowFocus, ...props })
|
|
|
150
160
|
</>
|
|
151
161
|
);
|
|
152
162
|
}
|
|
153
|
-
}
|
|
163
|
+
}
|
|
154
164
|
|
|
155
|
-
LoadingDiff.defaultProps = {
|
|
156
|
-
limit: 25,
|
|
157
|
-
sideBySide: false,
|
|
158
|
-
refetchOnWindowFocus: true,
|
|
159
|
-
};
|
|
160
165
|
|
|
161
166
|
export default LoadingDiff;
|
|
@@ -14,19 +14,146 @@
|
|
|
14
14
|
* along with this program. If not, see https://www.gnu.org/licenses/.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import { storiesOf } from "@storybook/react";
|
|
17
|
+
// import { storiesOf } from "@storybook/react";
|
|
18
|
+
// import React, { FC, ReactNode } from "react";
|
|
19
|
+
// import styled from "styled-components";
|
|
20
|
+
// import repository from "../__resources__/repository";
|
|
21
|
+
// // @ts-ignore ignore unknown png
|
|
22
|
+
// import Git from "../__resources__/git-logo.png";
|
|
23
|
+
// import RepositoryEntry from "./RepositoryEntry";
|
|
24
|
+
// import { Binder, BinderContext } from "@scm-manager/ui-extensions";
|
|
25
|
+
// import { Repository } from "@scm-manager/ui-types";
|
|
26
|
+
// import Image from "../Image";
|
|
27
|
+
// import { MemoryRouter } from "react-router-dom";
|
|
28
|
+
// import { Color } from "../styleConstants";
|
|
29
|
+
// import RepositoryFlag from "./RepositoryFlag";
|
|
30
|
+
//
|
|
31
|
+
// const baseDate = "2020-03-26T12:13:42+02:00";
|
|
32
|
+
//
|
|
33
|
+
// const Spacing = styled.div`
|
|
34
|
+
// margin: 2rem;
|
|
35
|
+
// `;
|
|
36
|
+
//
|
|
37
|
+
// const Container: FC<{ children: ReactNode }> = ({ children }) => <Spacing>{children}</Spacing>;
|
|
38
|
+
//
|
|
39
|
+
// const bindAvatar = (binder: Binder, avatar: string) => {
|
|
40
|
+
// binder.bind("repos.repository-avatar", () => {
|
|
41
|
+
// return <Image src={avatar} alt="Logo" />;
|
|
42
|
+
// });
|
|
43
|
+
// };
|
|
44
|
+
//
|
|
45
|
+
// const bindFlag = (binder: Binder, color: Color, label: string) => {
|
|
46
|
+
// binder.bind("repository.card.flags", () => (
|
|
47
|
+
// <RepositoryFlag title={label} color={color} tooltipLocation="right">
|
|
48
|
+
// {label}
|
|
49
|
+
// </RepositoryFlag>
|
|
50
|
+
// ));
|
|
51
|
+
// };
|
|
52
|
+
//
|
|
53
|
+
// const bindBeforeTitle = (binder: Binder, extension: ReactNode) => {
|
|
54
|
+
// binder.bind("repository.card.beforeTitle", () => {
|
|
55
|
+
// return extension;
|
|
56
|
+
// });
|
|
57
|
+
// };
|
|
58
|
+
//
|
|
59
|
+
// const withBinder = (binder: Binder, repo: Repository) => {
|
|
60
|
+
// return (
|
|
61
|
+
// <BinderContext.Provider value={binder}>
|
|
62
|
+
// <RepositoryEntry repository={repo} baseDate={baseDate} />
|
|
63
|
+
// </BinderContext.Provider>
|
|
64
|
+
// );
|
|
65
|
+
// };
|
|
66
|
+
//
|
|
67
|
+
// const archivedRepository = { ...repository, archived: true };
|
|
68
|
+
// const exportingRepository = { ...repository, exporting: true };
|
|
69
|
+
// const longTextRepository = {
|
|
70
|
+
// ...repository,
|
|
71
|
+
// name: "veeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeery-loooooooooooooooooooooooooooooooooooooooooooooooooooong-repooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo-naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaame",
|
|
72
|
+
// description:
|
|
73
|
+
// "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.",
|
|
74
|
+
// };
|
|
75
|
+
// const healthCheckFailedRepository = {
|
|
76
|
+
// ...repository,
|
|
77
|
+
// healthCheckFailures: [
|
|
78
|
+
// {
|
|
79
|
+
// id: "4211",
|
|
80
|
+
// summary: "Something failed",
|
|
81
|
+
// description: "Something realy bad happend",
|
|
82
|
+
// url: "https://something-realy-bad.happend",
|
|
83
|
+
// },
|
|
84
|
+
// ],
|
|
85
|
+
// };
|
|
86
|
+
// const archivedExportingRepository = {
|
|
87
|
+
// ...repository,
|
|
88
|
+
// archived: true,
|
|
89
|
+
// exporting: true,
|
|
90
|
+
// description:
|
|
91
|
+
// "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.",
|
|
92
|
+
// };
|
|
93
|
+
//
|
|
94
|
+
// storiesOf("Repositories/RepositoryEntry", module)
|
|
95
|
+
// .addDecorator((story) => <MemoryRouter initialEntries={["/"]}>{story()}</MemoryRouter>)
|
|
96
|
+
// .addDecorator((storyFn) => <Container>{storyFn()}</Container>)
|
|
97
|
+
// .add("Default", () => {
|
|
98
|
+
// return <RepositoryEntry repository={repository} baseDate={baseDate} />;
|
|
99
|
+
// })
|
|
100
|
+
// .add("Avatar EP", () => {
|
|
101
|
+
// const binder = new Binder("avatar");
|
|
102
|
+
// bindAvatar(binder, Git);
|
|
103
|
+
// return withBinder(binder, repository);
|
|
104
|
+
// })
|
|
105
|
+
// .add("Before Title EP", () => {
|
|
106
|
+
// const binder = new Binder("title");
|
|
107
|
+
// bindBeforeTitle(binder, <i className="far fa-star" />);
|
|
108
|
+
// return withBinder(binder, repository);
|
|
109
|
+
// })
|
|
110
|
+
// .add("Archived", () => {
|
|
111
|
+
// const binder = new Binder("title");
|
|
112
|
+
// bindAvatar(binder, Git);
|
|
113
|
+
// return withBinder(binder, archivedRepository);
|
|
114
|
+
// })
|
|
115
|
+
// .add("Exporting", () => {
|
|
116
|
+
// const binder = new Binder("title");
|
|
117
|
+
// bindAvatar(binder, Git);
|
|
118
|
+
// return withBinder(binder, exportingRepository);
|
|
119
|
+
// })
|
|
120
|
+
// .add("HealthCheck Failure", () => {
|
|
121
|
+
// const binder = new Binder("title");
|
|
122
|
+
// bindAvatar(binder, Git);
|
|
123
|
+
// return withBinder(binder, healthCheckFailedRepository);
|
|
124
|
+
// })
|
|
125
|
+
// .add("RepositoryFlag EP", () => {
|
|
126
|
+
// const binder = new Binder("title");
|
|
127
|
+
// bindAvatar(binder, Git);
|
|
128
|
+
// bindFlag(binder, "success", "awesome");
|
|
129
|
+
// bindFlag(binder, "warning", "ouhhh...");
|
|
130
|
+
// return withBinder(binder, healthCheckFailedRepository);
|
|
131
|
+
// })
|
|
132
|
+
// .add("MultiRepositoryTags", () => {
|
|
133
|
+
// const binder = new Binder("title");
|
|
134
|
+
// bindAvatar(binder, Git);
|
|
135
|
+
// return withBinder(binder, archivedExportingRepository);
|
|
136
|
+
// })
|
|
137
|
+
// .add("With long texts", () => {
|
|
138
|
+
// return <RepositoryEntry repository={longTextRepository} baseDate={baseDate} />;
|
|
139
|
+
// });
|
|
140
|
+
|
|
18
141
|
import React, { FC, ReactNode } from "react";
|
|
19
142
|
import styled from "styled-components";
|
|
20
|
-
import
|
|
21
|
-
// @ts-ignore ignore unknown png
|
|
22
|
-
import Git from "../__resources__/git-logo.png";
|
|
23
|
-
import RepositoryEntry from "./RepositoryEntry";
|
|
143
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
24
144
|
import { Binder, BinderContext } from "@scm-manager/ui-extensions";
|
|
25
145
|
import { Repository } from "@scm-manager/ui-types";
|
|
146
|
+
|
|
147
|
+
import RepositoryEntry from "./RepositoryEntry";
|
|
148
|
+
import RepositoryFlag from "./RepositoryFlag";
|
|
26
149
|
import Image from "../Image";
|
|
27
|
-
import { MemoryRouter } from "react-router-dom";
|
|
28
150
|
import { Color } from "../styleConstants";
|
|
29
|
-
import
|
|
151
|
+
import repository from "../__resources__/repository";
|
|
152
|
+
// @ts-ignore ignore unknown png
|
|
153
|
+
import Git from "../__resources__/git-logo.png";
|
|
154
|
+
import { MemoryRouter } from "react-router-dom";
|
|
155
|
+
|
|
156
|
+
// --- Helfer-Funktionen und Mock-Daten (aus der Original-Story übernommen) ---
|
|
30
157
|
|
|
31
158
|
const baseDate = "2020-03-26T12:13:42+02:00";
|
|
32
159
|
|
|
@@ -34,12 +161,10 @@ const Spacing = styled.div`
|
|
|
34
161
|
margin: 2rem;
|
|
35
162
|
`;
|
|
36
163
|
|
|
37
|
-
const Container: FC = ({ children }) => <Spacing>{children}</Spacing>;
|
|
164
|
+
const Container: FC<{ children: ReactNode }> = ({ children }) => <Spacing>{children}</Spacing>;
|
|
38
165
|
|
|
39
166
|
const bindAvatar = (binder: Binder, avatar: string) => {
|
|
40
|
-
binder.bind("repos.repository-avatar", () => {
|
|
41
|
-
return <Image src={avatar} alt="Logo" />;
|
|
42
|
-
});
|
|
167
|
+
binder.bind("repos.repository-avatar", () => <Image src={avatar} alt="Logo" />);
|
|
43
168
|
};
|
|
44
169
|
|
|
45
170
|
const bindFlag = (binder: Binder, color: Color, label: string) => {
|
|
@@ -51,26 +176,21 @@ const bindFlag = (binder: Binder, color: Color, label: string) => {
|
|
|
51
176
|
};
|
|
52
177
|
|
|
53
178
|
const bindBeforeTitle = (binder: Binder, extension: ReactNode) => {
|
|
54
|
-
binder.bind("repository.card.beforeTitle", () =>
|
|
55
|
-
return extension;
|
|
56
|
-
});
|
|
179
|
+
binder.bind("repository.card.beforeTitle", () => extension);
|
|
57
180
|
};
|
|
58
181
|
|
|
59
|
-
const withBinder = (binder: Binder, repo: Repository) =>
|
|
60
|
-
|
|
61
|
-
<
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
);
|
|
65
|
-
};
|
|
182
|
+
const withBinder = (binder: Binder, repo: Repository) => (
|
|
183
|
+
<BinderContext.Provider value={binder}>
|
|
184
|
+
<RepositoryEntry repository={repo} baseDate={baseDate} />
|
|
185
|
+
</BinderContext.Provider>
|
|
186
|
+
);
|
|
66
187
|
|
|
67
188
|
const archivedRepository = { ...repository, archived: true };
|
|
68
189
|
const exportingRepository = { ...repository, exporting: true };
|
|
69
190
|
const longTextRepository = {
|
|
70
191
|
...repository,
|
|
71
192
|
name: "veeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeery-loooooooooooooooooooooooooooooooooooooooooooooooooooong-repooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo-naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaame",
|
|
72
|
-
description:
|
|
73
|
-
"Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.",
|
|
193
|
+
description: "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt...",
|
|
74
194
|
};
|
|
75
195
|
const healthCheckFailedRepository = {
|
|
76
196
|
...repository,
|
|
@@ -87,53 +207,97 @@ const archivedExportingRepository = {
|
|
|
87
207
|
...repository,
|
|
88
208
|
archived: true,
|
|
89
209
|
exporting: true,
|
|
90
|
-
description:
|
|
91
|
-
|
|
210
|
+
description: "Lorem ipsum dolor sit amet...",
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
const meta: Meta<typeof RepositoryEntry> = {
|
|
214
|
+
title: "Repositories/RepositoryEntry",
|
|
215
|
+
component: RepositoryEntry,
|
|
216
|
+
decorators: [
|
|
217
|
+
(Story) => <MemoryRouter initialEntries={["/"]}>{Story()}</MemoryRouter>,
|
|
218
|
+
(Story) => <Container>{Story()}</Container>],
|
|
219
|
+
tags: ["autodocs"],
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
export default meta;
|
|
223
|
+
|
|
224
|
+
type Story = StoryObj<typeof meta>;
|
|
225
|
+
|
|
226
|
+
export const Default: Story = {
|
|
227
|
+
args: {
|
|
228
|
+
repository: repository,
|
|
229
|
+
baseDate: baseDate,
|
|
230
|
+
},
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
export const WithLongTexts: Story = {
|
|
234
|
+
name: "With Long Texts",
|
|
235
|
+
args: {
|
|
236
|
+
repository: longTextRepository,
|
|
237
|
+
baseDate: baseDate,
|
|
238
|
+
},
|
|
92
239
|
};
|
|
93
240
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
return <RepositoryEntry repository={repository} baseDate={baseDate} />;
|
|
99
|
-
})
|
|
100
|
-
.add("Avatar EP", () => {
|
|
241
|
+
// Stories, die den BinderContext verwenden, nutzen eine `render`-Funktion
|
|
242
|
+
export const WithAvatarExtension: Story = {
|
|
243
|
+
name: "With Avatar Extension",
|
|
244
|
+
render: () => {
|
|
101
245
|
const binder = new Binder("avatar");
|
|
102
246
|
bindAvatar(binder, Git);
|
|
103
247
|
return withBinder(binder, repository);
|
|
104
|
-
}
|
|
105
|
-
|
|
248
|
+
},
|
|
249
|
+
};
|
|
250
|
+
|
|
251
|
+
export const WithBeforeTitleExtension: Story = {
|
|
252
|
+
name: "With Before Title Extension",
|
|
253
|
+
render: () => {
|
|
106
254
|
const binder = new Binder("title");
|
|
107
255
|
bindBeforeTitle(binder, <i className="far fa-star" />);
|
|
108
256
|
return withBinder(binder, repository);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
|
|
257
|
+
},
|
|
258
|
+
};
|
|
259
|
+
|
|
260
|
+
export const Archived: Story = {
|
|
261
|
+
render: () => {
|
|
262
|
+
const binder = new Binder("archived");
|
|
112
263
|
bindAvatar(binder, Git);
|
|
113
264
|
return withBinder(binder, archivedRepository);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
|
|
265
|
+
},
|
|
266
|
+
};
|
|
267
|
+
|
|
268
|
+
export const Exporting: Story = {
|
|
269
|
+
render: () => {
|
|
270
|
+
const binder = new Binder("exporting");
|
|
117
271
|
bindAvatar(binder, Git);
|
|
118
272
|
return withBinder(binder, exportingRepository);
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
|
|
273
|
+
},
|
|
274
|
+
};
|
|
275
|
+
|
|
276
|
+
export const WithHealthCheckFailure: Story = {
|
|
277
|
+
name: "With Health Check Failure",
|
|
278
|
+
render: () => {
|
|
279
|
+
const binder = new Binder("healthCheck");
|
|
122
280
|
bindAvatar(binder, Git);
|
|
123
281
|
return withBinder(binder, healthCheckFailedRepository);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
|
|
282
|
+
},
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
export const WithRepositoryFlagExtension: Story = {
|
|
286
|
+
name: "With Repository Flag Extension",
|
|
287
|
+
render: () => {
|
|
288
|
+
const binder = new Binder("flags");
|
|
127
289
|
bindAvatar(binder, Git);
|
|
128
290
|
bindFlag(binder, "success", "awesome");
|
|
129
291
|
bindFlag(binder, "warning", "ouhhh...");
|
|
130
292
|
return withBinder(binder, healthCheckFailedRepository);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
|
|
293
|
+
},
|
|
294
|
+
};
|
|
295
|
+
|
|
296
|
+
export const WithMultipleRepositoryTags: Story = {
|
|
297
|
+
name: "With Multiple Repository Tags",
|
|
298
|
+
render: () => {
|
|
299
|
+
const binder = new Binder("multiTags");
|
|
134
300
|
bindAvatar(binder, Git);
|
|
135
301
|
return withBinder(binder, archivedExportingRepository);
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
return <RepositoryEntry repository={longTextRepository} baseDate={baseDate} />;
|
|
139
|
-
});
|
|
302
|
+
},
|
|
303
|
+
};
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* along with this program. If not, see https://www.gnu.org/licenses/.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import React, { FC } from "react";
|
|
17
|
+
import React, { FC, ReactNode } from "react";
|
|
18
18
|
import { Color, Size } from "../styleConstants";
|
|
19
19
|
import { Card } from "@scm-manager/ui-layout";
|
|
20
20
|
import { CardVariant } from "@scm-manager/ui-core";
|
|
@@ -28,6 +28,7 @@ type Props = {
|
|
|
28
28
|
size?: Size;
|
|
29
29
|
tooltipLocation: TooltipLocation;
|
|
30
30
|
variant?: CardVariant;
|
|
31
|
+
children?: ReactNode;
|
|
31
32
|
};
|
|
32
33
|
|
|
33
34
|
const RepositoryFlag: FC<Props> = ({
|
|
@@ -14,11 +14,12 @@
|
|
|
14
14
|
* along with this program. If not, see https://www.gnu.org/licenses/.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import React, { FC } from "react";
|
|
17
|
+
import React, { FC, ReactNode } from "react";
|
|
18
18
|
import styled from "styled-components";
|
|
19
19
|
// @ts-ignore we have no typings for react-diff-view
|
|
20
20
|
import { Diff, useTokenizeWorker } from "react-diff-view";
|
|
21
|
-
import { FileDiff } from "@scm-manager/ui-types";
|
|
21
|
+
import { FileDiff, Hunk as HunkType } from "@scm-manager/ui-types";
|
|
22
|
+
|
|
22
23
|
import { determineLanguage } from "../languages";
|
|
23
24
|
import { useSyntaxHighlightingWorker } from "@scm-manager/ui-syntaxhighlighting";
|
|
24
25
|
|
|
@@ -67,6 +68,7 @@ type Props = {
|
|
|
67
68
|
viewType: "split" | "unified";
|
|
68
69
|
className?: string;
|
|
69
70
|
whitespace: boolean;
|
|
71
|
+
children?: ReactNode | ((hunks: HunkType[]) => ReactNode);
|
|
70
72
|
};
|
|
71
73
|
|
|
72
74
|
const findSyntaxHighlightingLanguage = (file: FileDiff) => {
|