@redocly/theme 0.21.2 → 0.22.0

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.
Files changed (60) hide show
  1. package/lib/components/Catalog/CatalogCard.d.ts +1 -0
  2. package/lib/components/Catalog/CatalogCard.js +2 -1
  3. package/lib/components/Feedback/Emotions.d.ts +4 -0
  4. package/lib/components/Feedback/Emotions.js +74 -0
  5. package/lib/components/Feedback/Feedback.js +6 -0
  6. package/lib/components/Feedback/Mood.d.ts +8 -0
  7. package/lib/components/Feedback/Mood.js +116 -0
  8. package/lib/components/Feedback/index.d.ts +1 -0
  9. package/lib/components/Feedback/index.js +3 -1
  10. package/lib/components/Feedback/types.d.ts +24 -0
  11. package/lib/components/OpenApiDocs/ScorecardBadges.d.ts +10 -0
  12. package/lib/components/OpenApiDocs/ScorecardBadges.js +36 -0
  13. package/lib/components/OpenApiDocs/index.d.ts +1 -0
  14. package/lib/components/OpenApiDocs/index.js +1 -0
  15. package/lib/config.d.ts +10 -1
  16. package/lib/config.js +4 -1
  17. package/lib/globalStyle.js +3 -0
  18. package/lib/icons/DissatisfiedIcon/DissatisfiedIcon.d.ts +4 -0
  19. package/lib/icons/DissatisfiedIcon/DissatisfiedIcon.js +18 -0
  20. package/lib/icons/DissatisfiedIcon/index.d.ts +1 -0
  21. package/lib/icons/DissatisfiedIcon/index.js +18 -0
  22. package/lib/icons/NeutralIcon/NeutralIcon.d.ts +4 -0
  23. package/lib/icons/NeutralIcon/NeutralIcon.js +18 -0
  24. package/lib/icons/NeutralIcon/index.d.ts +1 -0
  25. package/lib/icons/NeutralIcon/index.js +18 -0
  26. package/lib/icons/SatisfiedIcon/SatisfiedIcon.d.ts +4 -0
  27. package/lib/icons/SatisfiedIcon/SatisfiedIcon.js +18 -0
  28. package/lib/icons/SatisfiedIcon/index.d.ts +1 -0
  29. package/lib/icons/SatisfiedIcon/index.js +18 -0
  30. package/lib/icons/index.d.ts +3 -0
  31. package/lib/icons/index.js +3 -0
  32. package/lib/layouts/OIDCForbidden.d.ts +2 -0
  33. package/lib/layouts/OIDCForbidden.js +95 -0
  34. package/lib/layouts/index.d.ts +1 -0
  35. package/lib/layouts/index.js +1 -0
  36. package/lib/types/portal/src/shared/constants.d.ts +2 -1
  37. package/lib/types/portal/src/shared/constants.js +1 -0
  38. package/lib/types/portal/src/shared/types/feedback.d.ts +2 -2
  39. package/package.json +2 -2
  40. package/src/components/Catalog/CatalogCard.tsx +1 -1
  41. package/src/components/Feedback/Emotions.tsx +59 -0
  42. package/src/components/Feedback/Feedback.tsx +13 -1
  43. package/src/components/Feedback/Mood.tsx +133 -0
  44. package/src/components/Feedback/index.ts +1 -0
  45. package/src/components/Feedback/types.ts +21 -0
  46. package/src/components/OpenApiDocs/ScorecardBadges.tsx +55 -0
  47. package/src/components/OpenApiDocs/index.ts +1 -0
  48. package/src/config.ts +4 -1
  49. package/src/globalStyle.ts +3 -0
  50. package/src/icons/DissatisfiedIcon/DissatisfiedIcon.tsx +38 -0
  51. package/src/icons/DissatisfiedIcon/index.ts +1 -0
  52. package/src/icons/NeutralIcon/NeutralIcon.tsx +34 -0
  53. package/src/icons/NeutralIcon/index.ts +1 -0
  54. package/src/icons/SatisfiedIcon/SatisfiedIcon.tsx +45 -0
  55. package/src/icons/SatisfiedIcon/index.ts +1 -0
  56. package/src/icons/index.ts +3 -0
  57. package/src/layouts/OIDCForbidden.tsx +89 -0
  58. package/src/layouts/index.ts +1 -0
  59. package/src/types/portal/src/shared/constants.ts +1 -0
  60. package/src/types/portal/src/shared/types/feedback.ts +2 -2
@@ -0,0 +1,89 @@
1
+ import React, { useEffect, useState } from 'react';
2
+ import styled from 'styled-components';
3
+ import { useSearchParams } from 'react-router-dom';
4
+
5
+ import { useTranslate } from '@portal/hooks';
6
+
7
+ export function OIDCForbidden(): JSX.Element {
8
+ const { translate } = useTranslate();
9
+ const [searchParams, setSearchParams] = useSearchParams();
10
+ const [errorDescription, setErrorDescription] = useState<string>('');
11
+
12
+ const translationKeys = {
13
+ title: 'theme.page.forbidden.title',
14
+ };
15
+
16
+ // use whatever you want here
17
+ const URL_REGEX =
18
+ /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/;
19
+
20
+ const renderText = (text: string) =>
21
+ text.split(' ').map((part: string) =>
22
+ URL_REGEX.test(part) ? (
23
+ <ErrorDescriptionLink key={part} href={part}>
24
+ {part}{' '}
25
+ </ErrorDescriptionLink>
26
+ ) : (
27
+ part + ' '
28
+ ),
29
+ );
30
+
31
+ useEffect(() => {
32
+ if (Array.from(searchParams).length) {
33
+ setErrorDescription(searchParams.get('error_description') || searchParams.get('error') || '');
34
+ setSearchParams({});
35
+ }
36
+ }, [searchParams, setSearchParams]);
37
+
38
+ return (
39
+ <Wrapper data-component-name="Pages/OIDCForbidden">
40
+ <Header>403</Header>
41
+ <Description data-translation-key={translationKeys.title}>
42
+ {translate(translationKeys.title, 'Access forbidden')}
43
+ </Description>
44
+ {errorDescription && <ErrorDescription>{renderText(errorDescription)}</ErrorDescription>}
45
+ </Wrapper>
46
+ );
47
+ }
48
+
49
+ const Wrapper = styled.div`
50
+ display: flex;
51
+ flex-direction: column;
52
+ align-items: center;
53
+ justify-content: center;
54
+ margin: 25px auto;
55
+ font-family: var(--page-403-font-family);
56
+ text-align: center;
57
+ `;
58
+
59
+ const Header = styled.div`
60
+ color: var(--page-403-header-text-color);
61
+ margin: var(--page-403-header-margin);
62
+ font-size: var(--page-403-header-font-size);
63
+ line-height: var(--page-403-header-line-height);
64
+ font-weight: var(--page-403-header-font-weight);
65
+ `;
66
+
67
+ const Description = styled.div`
68
+ color: var(--page-403-description-text-color);
69
+ margin: var(--page-403-description-margin);
70
+ font-size: var(--page-403-description-font-size);
71
+ line-height: var(--page-403-description-line-height);
72
+ font-weight: var(--page-403-description-font-weight);
73
+ `;
74
+
75
+ const ErrorDescription = styled.div`
76
+ margin: var(--page-403-oidc-description-margin);
77
+ font-size: var(--page-403-oidc-description-font-size);
78
+ color: var(--page-403-description-text-color);
79
+ line-height: var(--page-403-description-line-height);
80
+ font-weight: var(--page-403-description-font-weight);
81
+ `;
82
+
83
+ const ErrorDescriptionLink = styled.a`
84
+ color: var(--link-text-color);
85
+
86
+ &:hover {
87
+ color: var(--link-hover-text-color);
88
+ }
89
+ `;
@@ -2,3 +2,4 @@ export * from '@theme/layouts/RootLayout';
2
2
  export * from '@theme/layouts/PageLayout';
3
3
  export * from '@theme/layouts/NotFound';
4
4
  export * from '@theme/layouts/Forbidden';
5
+ export * from '@theme/layouts/OIDCForbidden';
@@ -7,6 +7,7 @@ export enum FEEDBACK_TYPES {
7
7
  RATING = 'rating',
8
8
  SENTIMENT = 'sentiment',
9
9
  COMMENT = 'comment',
10
+ MOOD = 'mood',
10
11
  }
11
12
  export const DEV_LOGIN_SLUG = '/login/';
12
13
  export enum ExternalRoutes {
@@ -1,6 +1,6 @@
1
1
  import type { FEEDBACK_TYPES } from '../constants';
2
2
 
3
- import type { RatingProps, SentimentProps, CommentProps } from '@theme/components/Feedback';
3
+ import type {RatingProps, SentimentProps, CommentProps, MoodProps} from '@theme/components/Feedback';
4
4
 
5
5
  export type SubmitFeedbackParams = {
6
6
  type: string;
@@ -10,5 +10,5 @@ export type SubmitFeedbackParams = {
10
10
 
11
11
  export type FeedbackProps = {
12
12
  type: FEEDBACK_TYPES;
13
- settings: (RatingProps | SentimentProps | CommentProps)['settings'];
13
+ settings: (RatingProps | SentimentProps | CommentProps | MoodProps)['settings'];
14
14
  }