@redocly/theme 0.18.3-patch.0 → 0.18.3-patch.2
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/lib/components/Breadcrumbs/Breadcrumb.d.ts +1 -0
- package/lib/components/Breadcrumbs/Breadcrumb.js +2 -2
- package/lib/components/Breadcrumbs/Breadcrumbs.js +8 -1
- package/lib/components/Button/Button.js +6 -4
- package/lib/components/Button/styledVariables.js +25 -12
- package/lib/components/Catalog/Catalog.js +4 -4
- package/lib/components/Catalog/CatalogCard.js +15 -5
- package/lib/components/Catalog/styledVariables.js +5 -3
- package/lib/components/Catalog/useCatalog.js +12 -1
- package/lib/components/CodeBlock/CodeBlockContainer.js +3 -2
- package/lib/components/CodeBlock/CodeBlockControls.js +6 -2
- package/lib/components/CodeBlock/styledVariables.js +6 -4
- package/lib/components/ColorModeSwitcher/ColorModeSwitcher.js +2 -0
- package/lib/components/Dropdown/Dropdown.d.ts +3 -2
- package/lib/components/Dropdown/Dropdown.js +2 -1
- package/lib/components/EditPageButton/EditPageButton.js +7 -2
- package/lib/components/Feedback/Comment.js +5 -0
- package/lib/components/Feedback/Feedback.js +13 -3
- package/lib/components/Feedback/Rating.js +5 -1
- package/lib/components/Feedback/Reasons.js +5 -0
- package/lib/components/Feedback/Sentiment.js +11 -2
- package/lib/components/Feedback/Thumbs.js +4 -4
- package/lib/components/Filter/Filter.d.ts +2 -1
- package/lib/components/Filter/Filter.js +14 -5
- package/lib/components/Filter/FilterContent.d.ts +2 -1
- package/lib/components/Filter/FilterContent.js +12 -3
- package/lib/components/Filter/FilterPopover.d.ts +4 -4
- package/lib/components/Filter/FilterPopover.js +14 -4
- package/lib/components/Filter/FilterTag.js +1 -1
- package/lib/components/Footer/FooterColumn.js +2 -1
- package/lib/components/LastUpdated/index.d.ts +1 -0
- package/lib/components/LastUpdated/index.js +18 -0
- package/lib/components/LastUpdated/styledVariables.d.ts +1 -0
- package/lib/components/LastUpdated/styledVariables.js +11 -0
- package/lib/components/Menu/MenuItemLabel.js +2 -0
- package/lib/components/Menu/MenuLinkItem.js +2 -1
- package/lib/components/Menu/MobileMenu.js +5 -5
- package/lib/components/Menu/styledVariables.js +18 -7
- package/lib/components/Navbar/NavbarItem.d.ts +1 -1
- package/lib/components/Navbar/NavbarItem.js +9 -3
- package/lib/components/Navbar/styledVariables.js +5 -2
- package/lib/components/NavbarLogo/NavbarLogo.js +2 -1
- package/lib/components/NavbarLogo/index.d.ts +1 -0
- package/lib/components/NavbarLogo/index.js +1 -0
- package/lib/components/NavbarLogo/styledVariables.d.ts +1 -0
- package/lib/components/NavbarLogo/styledVariables.js +18 -0
- package/lib/components/Panel/styledVariables.js +3 -11
- package/lib/components/Profile/LoginLink.js +4 -1
- package/lib/components/Profile/MobileUserProfile.js +16 -5
- package/lib/components/Profile/UserProfile.js +5 -1
- package/lib/components/Search/ProductTag.js +1 -1
- package/lib/components/Select/Select.d.ts +1 -3
- package/lib/components/Select/Select.js +5 -2
- package/lib/components/Separator/Separator.js +11 -3
- package/lib/components/Separator/SeparatorItem.js +1 -7
- package/lib/components/Separator/SeparatorLine.js +7 -3
- package/lib/components/Sidebar/ApiCallItem.js +5 -3
- package/lib/components/Sidebar/SidebarLayout.js +2 -1
- package/lib/components/Sidebar/styledVariables.js +12 -7
- package/lib/components/Sidebar/types.d.ts +1 -0
- package/lib/components/SidebarActions/CollapseSidebarButton.js +4 -0
- package/lib/components/SidebarActions/SidebarActions.js +15 -3
- package/lib/components/SidebarActions/styled.js +14 -8
- package/lib/components/TableOfContent/TableOfContent.js +2 -1
- package/lib/components/Tag/Tag.d.ts +3 -1
- package/lib/components/Tag/Tag.js +10 -4
- package/lib/components/Tag/styledVariables.js +35 -30
- package/lib/components/Tiles/ThinTile.js +7 -5
- package/lib/components/Tiles/WideTile.js +10 -8
- package/lib/components/Typography/SectionHeader.js +2 -2
- package/lib/config.d.ts +84 -0
- package/lib/config.js +15 -1
- package/lib/globalStyle.js +43 -56
- package/lib/icons/PlusIcon/PlusIcon.js +1 -1
- package/lib/ui/ArrowBack.js +0 -1
- package/lib/ui/darkColors.js +5 -4
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.js +1 -0
- package/lib/utils/tags-parser.d.ts +1 -0
- package/lib/utils/tags-parser.js +10 -0
- package/package.json +2 -2
- package/src/components/Breadcrumbs/Breadcrumb.tsx +8 -2
- package/src/components/Breadcrumbs/Breadcrumbs.tsx +13 -1
- package/src/components/Button/Button.tsx +6 -4
- package/src/components/Button/styledVariables.ts +25 -12
- package/src/components/Catalog/Catalog.tsx +4 -8
- package/src/components/Catalog/CatalogCard.tsx +17 -6
- package/src/components/Catalog/styledVariables.ts +5 -3
- package/src/components/Catalog/useCatalog.ts +13 -1
- package/src/components/CodeBlock/CodeBlockContainer.tsx +3 -2
- package/src/components/CodeBlock/CodeBlockControls.tsx +6 -1
- package/src/components/CodeBlock/styledVariables.ts +6 -4
- package/src/components/ColorModeSwitcher/ColorModeSwitcher.tsx +3 -0
- package/src/components/Dropdown/Dropdown.tsx +4 -1
- package/src/components/EditPageButton/EditPageButton.tsx +7 -2
- package/src/components/Feedback/Comment.tsx +5 -0
- package/src/components/Feedback/Feedback.tsx +13 -3
- package/src/components/Feedback/Rating.tsx +5 -1
- package/src/components/Feedback/Reasons.tsx +5 -0
- package/src/components/Feedback/Sentiment.tsx +15 -2
- package/src/components/Feedback/Thumbs.tsx +4 -4
- package/src/components/Filter/Filter.tsx +25 -4
- package/src/components/Filter/FilterContent.tsx +21 -4
- package/src/components/Filter/FilterPopover.tsx +19 -11
- package/src/components/Filter/FilterTag.tsx +1 -1
- package/src/components/Footer/FooterColumn.tsx +2 -0
- package/src/components/LastUpdated/index.ts +1 -0
- package/src/components/LastUpdated/styledVariables.ts +8 -0
- package/src/components/Menu/MenuItemLabel.tsx +2 -0
- package/src/components/Menu/MenuLinkItem.tsx +6 -1
- package/src/components/Menu/MobileMenu.tsx +5 -5
- package/src/components/Menu/styledVariables.ts +18 -7
- package/src/components/Navbar/NavbarItem.tsx +10 -1
- package/src/components/Navbar/styledVariables.ts +5 -2
- package/src/components/NavbarLogo/NavbarLogo.tsx +12 -1
- package/src/components/NavbarLogo/index.ts +1 -0
- package/src/components/NavbarLogo/styledVariables.ts +15 -0
- package/src/components/Panel/styledVariables.ts +3 -11
- package/src/components/Profile/LoginLink.tsx +8 -1
- package/src/components/Profile/MobileUserProfile.tsx +22 -5
- package/src/components/Profile/UserProfile.tsx +5 -1
- package/src/components/Search/ProductTag.tsx +1 -1
- package/src/components/Select/Select.tsx +6 -5
- package/src/components/Separator/Separator.tsx +17 -3
- package/src/components/Separator/SeparatorItem.tsx +1 -7
- package/src/components/Separator/SeparatorLine.tsx +7 -3
- package/src/components/Sidebar/ApiCallItem.tsx +4 -2
- package/src/components/Sidebar/SidebarLayout.tsx +6 -1
- package/src/components/Sidebar/styledVariables.ts +12 -7
- package/src/components/Sidebar/types.ts +1 -0
- package/src/components/SidebarActions/CollapseSidebarButton.tsx +4 -0
- package/src/components/SidebarActions/SidebarActions.tsx +18 -3
- package/src/components/SidebarActions/styled.tsx +14 -8
- package/src/components/TableOfContent/TableOfContent.tsx +2 -0
- package/src/components/Tag/Tag.tsx +13 -4
- package/src/components/Tag/styledVariables.ts +35 -30
- package/src/components/Tiles/ThinTile.tsx +7 -5
- package/src/components/Tiles/WideTile.tsx +10 -8
- package/src/components/Typography/SectionHeader.ts +2 -2
- package/src/config.ts +19 -1
- package/src/globalStyle.ts +41 -57
- package/src/icons/PlusIcon/PlusIcon.tsx +7 -1
- package/src/ui/ArrowBack.tsx +0 -1
- package/src/ui/darkColors.tsx +5 -4
- package/src/utils/index.ts +1 -0
- package/src/utils/tags-parser.ts +8 -0
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
import { css } from 'styled-components';
|
|
2
2
|
|
|
3
3
|
export const button = css`
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Static classnames that can be used to override styles for components:
|
|
6
|
+
* download-specification-button, next-section-button, button-base
|
|
7
|
+
*/
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
* @tokens Button borders
|
|
11
|
+
*/
|
|
12
12
|
|
|
13
13
|
--button-border-width: 1px; //@presenter Border
|
|
14
14
|
--button-border-style: solid; //@presenter Border
|
|
15
15
|
--button-border-radius: var(--border-radius-md); // @presenter BorderRadius
|
|
16
16
|
--button-margin: 5px; // @presenter Spacing
|
|
17
17
|
--button-box-shadow: none; // @presenter Shadow
|
|
18
|
-
--button-hover-box-shadow:
|
|
19
|
-
--button-active-box-shadow:
|
|
18
|
+
--button-hover-box-shadow: none; // @presenter Shadow
|
|
19
|
+
--button-active-box-shadow: none; // @presenter Shadow
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
* @tokens Button typography
|
|
23
|
+
*/
|
|
24
24
|
|
|
25
25
|
--button-font-size: var(--font-size-base); // @presenter FontSize
|
|
26
26
|
--button-font-family: inherit; // @presenter FontFamily
|
|
@@ -36,8 +36,8 @@ export const button = css`
|
|
|
36
36
|
--button-large-padding: 8px 16px;
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
* @tokens Button icon
|
|
40
|
+
*/
|
|
41
41
|
--button-icon-width: 1em; // @presenter Spacing
|
|
42
42
|
--button-icon-height: 1em; // @presenter Spacing
|
|
43
43
|
|
|
@@ -87,5 +87,18 @@ export const button = css`
|
|
|
87
87
|
--button-background-color: transparent; // @presenter Color
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
+
/**
|
|
91
|
+
* @tokens Button text
|
|
92
|
+
*/
|
|
93
|
+
.button-text {
|
|
94
|
+
--button-color: var(--text-secondary); // @presenter Color
|
|
95
|
+
--button-border-color: transparent; // @presenter Color
|
|
96
|
+
--button-background-color: transparent; // @presenter Color
|
|
97
|
+
|
|
98
|
+
--button-hover-color: var(--text-primary); // @presenter Color
|
|
99
|
+
--button-hover-background-color: transparent; // @presenter Color
|
|
100
|
+
--button-hover-border-color: transparent; // @presenter Color
|
|
101
|
+
}
|
|
102
|
+
|
|
90
103
|
// @tokens End
|
|
91
104
|
`;
|
|
@@ -51,14 +51,10 @@ export default function Catalog(props: {
|
|
|
51
51
|
filters={filters}
|
|
52
52
|
filterTerm={filterTerm}
|
|
53
53
|
isMobile={false}
|
|
54
|
+
filterValuesCasing={catalogConfig.filterValuesCasing}
|
|
54
55
|
/>
|
|
55
56
|
{isAddingFilter && (
|
|
56
|
-
<FilterPopover
|
|
57
|
-
setIsAddingFilter={setIsAddingFilter}
|
|
58
|
-
setFilterTerm={setFilterTerm}
|
|
59
|
-
filters={filters}
|
|
60
|
-
filterTerm={filterTerm}
|
|
61
|
-
/>
|
|
57
|
+
<FilterPopover setIsAddingFilter={setIsAddingFilter} filters={filters} />
|
|
62
58
|
)}
|
|
63
59
|
<CatalogPageContent>
|
|
64
60
|
<CatalogPageDescriptionWrapper>
|
|
@@ -162,7 +158,7 @@ const CatalogDescription = styled.p`
|
|
|
162
158
|
`;
|
|
163
159
|
|
|
164
160
|
const CatalogPageWrapper = styled.div`
|
|
165
|
-
--sidebar-width: var(--catalog-sidebar-width,
|
|
161
|
+
--sidebar-width: var(--catalog-sidebar-width, 285px);
|
|
166
162
|
|
|
167
163
|
display: flex;
|
|
168
164
|
flex-direction: column;
|
|
@@ -192,7 +188,7 @@ const CatalogPageWrapper = styled.div`
|
|
|
192
188
|
}
|
|
193
189
|
`;
|
|
194
190
|
|
|
195
|
-
const FilterTagsWrapper = styled.div`
|
|
191
|
+
const FilterTagsWrapper = styled.div.attrs({ 'data-cy': 'Catalog/FilterTags' })`
|
|
196
192
|
padding: var(--filter-tags-wrapper-padding);
|
|
197
193
|
display: flex;
|
|
198
194
|
overflow-x: scroll;
|
|
@@ -6,11 +6,13 @@ import { Link } from '@portal/Link';
|
|
|
6
6
|
import { Highlight } from '@theme/ui/Highlight';
|
|
7
7
|
import { Tag } from '@theme/components/Tag';
|
|
8
8
|
import { PointingArrowIcon } from '@theme/icons';
|
|
9
|
+
import { telemetry } from '@portal/telemetry';
|
|
10
|
+
import { slug } from '@theme/utils';
|
|
9
11
|
|
|
10
12
|
export function CatalogCard({ item }: { item: CatalogItem }): JSX.Element {
|
|
11
13
|
return (
|
|
12
14
|
<Link key={item.docsLink || item.link} to={item.docsLink || item.link}>
|
|
13
|
-
<StyledCard>
|
|
15
|
+
<StyledCard onClick={() => telemetry.send('catalog_item_clicked', {})}>
|
|
14
16
|
<CardTitle>
|
|
15
17
|
<Highlight>{item.title}</Highlight>
|
|
16
18
|
</CardTitle>
|
|
@@ -22,9 +24,9 @@ export function CatalogCard({ item }: { item: CatalogItem }): JSX.Element {
|
|
|
22
24
|
{item.tags && (
|
|
23
25
|
<CardTags>
|
|
24
26
|
{(item.tags as string[]).map((tag, index) => (
|
|
25
|
-
<
|
|
27
|
+
<CardTag key={tag + index} color={slug(tag)}>
|
|
26
28
|
<Highlight>{tag}</Highlight>
|
|
27
|
-
</
|
|
29
|
+
</CardTag>
|
|
28
30
|
))}
|
|
29
31
|
</CardTags>
|
|
30
32
|
)}
|
|
@@ -46,20 +48,21 @@ const SelectButton = styled.div`
|
|
|
46
48
|
display: flex;
|
|
47
49
|
align-items: center;
|
|
48
50
|
justify-content: center;
|
|
51
|
+
transition: all 0.2s ease-in-out;
|
|
49
52
|
|
|
50
53
|
svg {
|
|
51
54
|
fill: var(--catalog-card-icon-color);
|
|
52
55
|
}
|
|
53
56
|
`;
|
|
54
57
|
|
|
55
|
-
const StyledCard = styled.div`
|
|
58
|
+
const StyledCard = styled.div.attrs({ 'data-cy': 'Catalog/CatalogCard' })`
|
|
56
59
|
min-height: var(--catalog-card-min-height);
|
|
57
60
|
height: 100%;
|
|
58
61
|
color: var(--catalog-card-text-color);
|
|
59
62
|
font-size: var(--catalog-card-font-size);
|
|
60
63
|
font-weight: var(--catalog-card-font-weight);
|
|
61
64
|
background-color: var(--catalog-card-background-color);
|
|
62
|
-
border:
|
|
65
|
+
border: var(--catalog-card-border-width) var(--catalog-card-border-style) var(--catalog-card-border-color);
|
|
63
66
|
transition: all 0.2s ease-in-out;
|
|
64
67
|
border-radius: var(--catalog-card-border-radius);
|
|
65
68
|
cursor: pointer;
|
|
@@ -114,4 +117,12 @@ const CardFooter = styled.div`
|
|
|
114
117
|
justify-content: space-between;
|
|
115
118
|
`;
|
|
116
119
|
|
|
117
|
-
const CardTags = styled.div
|
|
120
|
+
const CardTags = styled.div`
|
|
121
|
+
display: flex;
|
|
122
|
+
flex-wrap: wrap;
|
|
123
|
+
gap: var(--spacing-xxs);
|
|
124
|
+
`;
|
|
125
|
+
|
|
126
|
+
const CardTag = styled(Tag)`
|
|
127
|
+
margin: 0;
|
|
128
|
+
`;
|
|
@@ -41,7 +41,7 @@ export const catalog = css`
|
|
|
41
41
|
--catalog-separator-label-margin: 0 var(--spacing-xs);
|
|
42
42
|
--catalog-separator-count-height: var(--control-height-xs);
|
|
43
43
|
--catalog-separator-count-padding: 0 var(--spacing-xxs);
|
|
44
|
-
--catalog-separator-count-border-radius: var(--
|
|
44
|
+
--catalog-separator-count-border-radius: var(--border-radius-xlg);
|
|
45
45
|
--catalog-separator-count-border-color: var(--border-secondary);
|
|
46
46
|
--catalog-separator-count-background: var(--bg-raised);
|
|
47
47
|
|
|
@@ -54,8 +54,10 @@ export const catalog = css`
|
|
|
54
54
|
--catalog-card-font-weight: var(--font-weight-regular);
|
|
55
55
|
--catalog-card-background-color: var(--bg-raised);
|
|
56
56
|
--catalog-card-border-color: var(--border-secondary);
|
|
57
|
+
--catalog-card-border-width: var(--border-width);
|
|
58
|
+
--catalog-card-border-style: var(--border-style);
|
|
57
59
|
--catalog-card-hover-border-color: var(--border-primary);
|
|
58
|
-
--catalog-card-border-radius: var(--
|
|
60
|
+
--catalog-card-border-radius: var(--border-radius-lg);
|
|
59
61
|
|
|
60
62
|
/**
|
|
61
63
|
* @tokens Catalog card button
|
|
@@ -84,7 +86,7 @@ export const catalog = css`
|
|
|
84
86
|
--catalog-card-description-line-clamp: 3;
|
|
85
87
|
--catalog-card-description-margin-bottom: var(--spacing-base);
|
|
86
88
|
--catalog-card-content-background-color: var(--bg-base);
|
|
87
|
-
--catalog-card-content-border-radius: var(--
|
|
89
|
+
--catalog-card-content-border-radius: var(--border-radius-lg);
|
|
88
90
|
--catalog-card-content-padding: var(--spacing-base);
|
|
89
91
|
|
|
90
92
|
// @tokens End
|
|
@@ -3,6 +3,7 @@ import { useLocation, useNavigate } from 'react-router-dom';
|
|
|
3
3
|
|
|
4
4
|
import type { Location } from 'react-router-dom';
|
|
5
5
|
|
|
6
|
+
import { telemetry } from '@portal/telemetry';
|
|
6
7
|
import type { ResolvedNavItem } from '@theme/types/portal';
|
|
7
8
|
import type {
|
|
8
9
|
CatalogItem,
|
|
@@ -45,6 +46,7 @@ export function useCatalog(items: ResolvedNavItem[], config: CatalogConfig): Fil
|
|
|
45
46
|
}
|
|
46
47
|
return [...prev.slice(0, filterIdx), newFilterOptions, ...prev.slice(filterIdx + 1)];
|
|
47
48
|
});
|
|
49
|
+
telemetry.send('catalog_filter_changed', { type: 'toggle' });
|
|
48
50
|
window.scrollTo(0, 0);
|
|
49
51
|
}, []);
|
|
50
52
|
|
|
@@ -68,6 +70,7 @@ export function useCatalog(items: ResolvedNavItem[], config: CatalogConfig): Fil
|
|
|
68
70
|
: f,
|
|
69
71
|
);
|
|
70
72
|
});
|
|
73
|
+
telemetry.send('catalog_filter_changed', { type: 'select' });
|
|
71
74
|
window.scrollTo(0, 0);
|
|
72
75
|
},
|
|
73
76
|
[filtersWithOptions],
|
|
@@ -153,7 +156,16 @@ export function useCatalog(items: ResolvedNavItem[], config: CatalogConfig): Fil
|
|
|
153
156
|
? groupByFirstFilter(resolvedFilters, filteredItems)
|
|
154
157
|
: [{ title: 'APIs', items: filteredItems }];
|
|
155
158
|
|
|
156
|
-
return {
|
|
159
|
+
return {
|
|
160
|
+
groups,
|
|
161
|
+
filters: resolvedFilters,
|
|
162
|
+
setFilterTerm: (newTerm) => {
|
|
163
|
+
setFilterTerm(newTerm);
|
|
164
|
+
|
|
165
|
+
telemetry.send('catalog_filter_changed', { type: 'term' });
|
|
166
|
+
},
|
|
167
|
+
filterTerm,
|
|
168
|
+
};
|
|
157
169
|
}, [
|
|
158
170
|
filtersWithOptions,
|
|
159
171
|
normalizedItems,
|
|
@@ -10,12 +10,13 @@ export const CodeBlockContainer = styled.pre.attrs<{ className?: string }>(({ cl
|
|
|
10
10
|
overflow-x: auto;
|
|
11
11
|
max-height: var(--code-block-max-height);
|
|
12
12
|
font-family: var(--code-block-font-family);
|
|
13
|
-
line-height: var(--code-line-height);
|
|
13
|
+
line-height: var(--code-block-line-height);
|
|
14
|
+
font-weight: var(--code-block-font-weight);
|
|
14
15
|
padding: var(--code-block-padding);
|
|
15
16
|
margin: var(--code-block-margin);
|
|
16
17
|
background-color: var(--code-block-background-color);
|
|
17
18
|
color: var(--code-block-text-color);
|
|
18
|
-
font-size: var(--code-font-size);
|
|
19
|
+
font-size: var(--code-block-font-size);
|
|
19
20
|
white-space: var(--code-wrap, pre);
|
|
20
21
|
max-height: var(--code-block-max-height, 600px);
|
|
21
22
|
word-break: var(--code-block-word-break, initial);
|
|
@@ -4,6 +4,7 @@ import styled from 'styled-components';
|
|
|
4
4
|
import { CodeBlockControlButton } from '@theme/components/CodeBlock';
|
|
5
5
|
import { CollapseIcon, DeselectIcon, ExpandIcon, ReportIcon, SelectIcon } from '@theme/icons';
|
|
6
6
|
import { useThemeConfig } from '@theme/hooks';
|
|
7
|
+
import { telemetry } from '@portal/telemetry';
|
|
7
8
|
|
|
8
9
|
import { CopyButton } from '../CopyButton';
|
|
9
10
|
|
|
@@ -68,7 +69,10 @@ export function CodeBlockControls({
|
|
|
68
69
|
toasterDuration={copy.toasterDuration}
|
|
69
70
|
buttonText={copy.label}
|
|
70
71
|
tooltipText={copy.tooltipText}
|
|
71
|
-
onCopyClick={
|
|
72
|
+
onCopyClick={() => {
|
|
73
|
+
copy?.onClick;
|
|
74
|
+
telemetry.send('code_snippet_copied', {});
|
|
75
|
+
}}
|
|
72
76
|
/>
|
|
73
77
|
) : null}
|
|
74
78
|
|
|
@@ -139,6 +143,7 @@ export function CodeBlockControls({
|
|
|
139
143
|
asIcon={controlsType === 'icon'}
|
|
140
144
|
title={report.tooltipText}
|
|
141
145
|
{...report.props}
|
|
146
|
+
onClick={() => telemetry.send('code_snippet_reported', {})}
|
|
142
147
|
>
|
|
143
148
|
{controlsType === 'icon' ? <ReportIcon /> : report.props?.buttonText || 'Report'}
|
|
144
149
|
</CodeBlockControlButton>
|
|
@@ -28,6 +28,8 @@ export const code = css`
|
|
|
28
28
|
*/
|
|
29
29
|
--code-block-font-size: var(--code-font-size); // @presenter FontSize
|
|
30
30
|
--code-block-font-family: var(--code-font-family); // @presenter FontFamily
|
|
31
|
+
--code-block-line-height: var(--code-line-height); // @presenter LineHeight
|
|
32
|
+
--code-block-font-weight: var(--code-font-weight); // @presenter FontWeight
|
|
31
33
|
--code-block-text-color: var(--text-secondary); // @presenter Color
|
|
32
34
|
--code-block-background-color: var(--bg-raised); // @presenter Color
|
|
33
35
|
--code-block-border-color: var(--border-primary); // @presenter Color
|
|
@@ -54,7 +56,7 @@ export const code = css`
|
|
|
54
56
|
* @tokens Code Block tokens
|
|
55
57
|
*/
|
|
56
58
|
--code-block-tokens-default-color: var(--text-secondary); // @presenter Color
|
|
57
|
-
--code-block-tokens-comment-color:
|
|
59
|
+
--code-block-tokens-comment-color: var(--text-placeholder); // @presenter Color
|
|
58
60
|
--code-block-tokens-prolog-color: var(--code-block-tokens-comment-color); // @presenter Color
|
|
59
61
|
--code-block-tokens-doctype-color: var(--code-block-tokens-comment-color); // @presenter Color
|
|
60
62
|
--code-block-tokens-cdata-color: var(--code-block-tokens-comment-color); // @presenter Color
|
|
@@ -64,8 +66,8 @@ export const code = css`
|
|
|
64
66
|
--code-block-tokens-constant-color: var(--code-block-tokens-default-color); // @presenter Color
|
|
65
67
|
--code-block-tokens-symbol-color: var(--code-block-tokens-default-color); // @presenter Color
|
|
66
68
|
--code-block-tokens-boolean-color: var(--color-geekblue-7); // @presenter Color
|
|
67
|
-
--code-block-tokens-string-color: var(--color-
|
|
68
|
-
--code-block-tokens-property-string-color: var(--
|
|
69
|
+
--code-block-tokens-string-color: var(--color-green-6); // @presenter Color
|
|
70
|
+
--code-block-tokens-property-string-color: var(--text-secondary); // @presenter Color
|
|
69
71
|
--code-block-tokens-selector-color: var(--code-block-tokens-string-color); // @presenter Color
|
|
70
72
|
--code-block-tokens-attr-name-color: var(--code-block-tokens-string-color); // @presenter Color
|
|
71
73
|
--code-block-tokens-char-color: var(--code-block-tokens-string-color); // @presenter Color
|
|
@@ -79,7 +81,7 @@ export const code = css`
|
|
|
79
81
|
--code-block-tokens-keyword-color: var(--color-magneta-6); // @presenter Color
|
|
80
82
|
--code-block-tokens-atrule-color: var(--code-block-tokens-keyword-color); // @presenter Color
|
|
81
83
|
--code-block-tokens-attr-value-color: var(--code-block-tokens-keyword-color); // @presenter Color
|
|
82
|
-
--code-block-tokens-regex-color: var(--color-gold-
|
|
84
|
+
--code-block-tokens-regex-color: var(--color-gold-5); // @presenter Color
|
|
83
85
|
--code-block-tokens-important-color: var(--code-block-tokens-regex-color); // @presenter Color
|
|
84
86
|
--code-block-tokens-deleted-color: var(--color-red-6); // @presenter Color
|
|
85
87
|
|
|
@@ -3,6 +3,7 @@ import styled from 'styled-components';
|
|
|
3
3
|
|
|
4
4
|
import { ColorModeIcon } from '@theme/icons/ColorModeIcon';
|
|
5
5
|
import { useMount, useThemeConfig } from '@theme/hooks';
|
|
6
|
+
import { telemetry } from '@portal/telemetry';
|
|
6
7
|
|
|
7
8
|
interface ColorModeSwitcherProps {
|
|
8
9
|
className?: string;
|
|
@@ -34,6 +35,8 @@ export function ColorModeSwitcher(props: ColorModeSwitcherProps): JSX.Element |
|
|
|
34
35
|
window.requestAnimationFrame(() => {
|
|
35
36
|
document.documentElement.classList.remove('notransition');
|
|
36
37
|
});
|
|
38
|
+
|
|
39
|
+
telemetry.send('color_mode_switched', { from: activeColorMode, to: mode });
|
|
37
40
|
};
|
|
38
41
|
|
|
39
42
|
return (
|
|
@@ -5,7 +5,7 @@ import { ArrowIcon } from '@theme/icons';
|
|
|
5
5
|
import { useOutsideClick } from '@theme/hooks';
|
|
6
6
|
|
|
7
7
|
export interface DropdownProps {
|
|
8
|
-
children
|
|
8
|
+
children?: React.ReactNode;
|
|
9
9
|
items: JSX.Element[] | string[];
|
|
10
10
|
dataAttributes?: Record<string, string>;
|
|
11
11
|
className?: string;
|
|
@@ -14,6 +14,7 @@ export interface DropdownProps {
|
|
|
14
14
|
placement?: 'top' | 'bottom';
|
|
15
15
|
alignment?: 'start' | 'end';
|
|
16
16
|
onChange?: (value: React.ReactNode | string) => void;
|
|
17
|
+
icon?: React.ReactNode;
|
|
17
18
|
}
|
|
18
19
|
|
|
19
20
|
export const Dropdown = ({
|
|
@@ -26,6 +27,7 @@ export const Dropdown = ({
|
|
|
26
27
|
dataAttributes,
|
|
27
28
|
placement,
|
|
28
29
|
alignment,
|
|
30
|
+
icon,
|
|
29
31
|
}: DropdownProps) => {
|
|
30
32
|
const dropdownRef = useRef<HTMLDivElement | null>(null);
|
|
31
33
|
|
|
@@ -62,6 +64,7 @@ export const Dropdown = ({
|
|
|
62
64
|
>
|
|
63
65
|
<DropdownHeader>
|
|
64
66
|
{children}
|
|
67
|
+
{icon}
|
|
65
68
|
{withArrow ? isOpen ? <ArrowIcon direction="up" /> : <ArrowIcon direction="down" /> : null}
|
|
66
69
|
</DropdownHeader>
|
|
67
70
|
{isOpen && (
|
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
|
|
4
4
|
import { Link } from '@portal/Link';
|
|
5
|
+
import { telemetry } from '@portal/telemetry';
|
|
5
6
|
|
|
6
7
|
export interface EditPageButtonProps {
|
|
7
8
|
text: string;
|
|
@@ -11,7 +12,7 @@ export interface EditPageButtonProps {
|
|
|
11
12
|
|
|
12
13
|
export const EditPageButton = ({ text, to, icon }: EditPageButtonProps): JSX.Element => {
|
|
13
14
|
return (
|
|
14
|
-
<EditButton to={to}>
|
|
15
|
+
<EditButton to={to} onClick={() => telemetry.send('edit_page_link_clicked', {})}>
|
|
15
16
|
{icon ? <ButtonIcon src={icon} /> : null}
|
|
16
17
|
<ButtonText>{text}</ButtonText>
|
|
17
18
|
</EditButton>
|
|
@@ -21,12 +22,16 @@ export const EditPageButton = ({ text, to, icon }: EditPageButtonProps): JSX.Ele
|
|
|
21
22
|
const EditButton = styled(Link)`
|
|
22
23
|
margin-left: auto;
|
|
23
24
|
display: inline-flex;
|
|
24
|
-
color: var(--
|
|
25
|
+
color: var(--text-secondary);
|
|
25
26
|
font-weight: var(--font-weight-bold);
|
|
26
27
|
font-size: var(--font-size-base);
|
|
27
28
|
font-family: var(--font-family-base);
|
|
28
29
|
text-decoration: none;
|
|
29
30
|
|
|
31
|
+
&:hover {
|
|
32
|
+
color: var(--text-primary);
|
|
33
|
+
}
|
|
34
|
+
|
|
30
35
|
@media print {
|
|
31
36
|
display: none;
|
|
32
37
|
}
|
|
@@ -67,6 +67,11 @@ const Wrapper = styled.div`
|
|
|
67
67
|
`;
|
|
68
68
|
|
|
69
69
|
const Label = styled.h3`
|
|
70
|
+
font-family: var(--h3-font-family);
|
|
71
|
+
font-weight: var(--h3-font-weight);
|
|
72
|
+
font-size: var(--h3-font-size);
|
|
73
|
+
line-height: var(--h3-line-height);
|
|
74
|
+
color: var(--h3-text-color);
|
|
70
75
|
margin-right: 15px;
|
|
71
76
|
`;
|
|
72
77
|
|
|
@@ -6,6 +6,7 @@ import type { FeedbackProps } from '@theme/types/portal/src/shared/types/feedbac
|
|
|
6
6
|
import { Rating, Sentiment, Comment } from '@theme/components/Feedback';
|
|
7
7
|
import { useThemeConfig } from '@theme/hooks';
|
|
8
8
|
import { useSubmitFeedback } from '@portal/Feedback/useSubmitFeedback';
|
|
9
|
+
import { telemetry } from '@portal/telemetry';
|
|
9
10
|
|
|
10
11
|
export const Feedback = (props: FeedbackProps & { path?: string }) => {
|
|
11
12
|
const { submitFeedback } = useSubmitFeedback();
|
|
@@ -20,7 +21,10 @@ export const Feedback = (props: FeedbackProps & { path?: string }) => {
|
|
|
20
21
|
<Wrapper>
|
|
21
22
|
<Rating
|
|
22
23
|
settings={settings}
|
|
23
|
-
onSubmit={(values) =>
|
|
24
|
+
onSubmit={(values) => {
|
|
25
|
+
submitFeedback({ type: 'rating', values, path });
|
|
26
|
+
telemetry.send('feedback_sent', { type: 'rating' });
|
|
27
|
+
}}
|
|
24
28
|
/>
|
|
25
29
|
</Wrapper>
|
|
26
30
|
);
|
|
@@ -29,7 +33,10 @@ export const Feedback = (props: FeedbackProps & { path?: string }) => {
|
|
|
29
33
|
<Wrapper>
|
|
30
34
|
<Sentiment
|
|
31
35
|
settings={settings}
|
|
32
|
-
onSubmit={(values) =>
|
|
36
|
+
onSubmit={(values) => {
|
|
37
|
+
submitFeedback({ type: 'sentiment', values, path });
|
|
38
|
+
telemetry.send('feedback_sent', { type: 'sentiment' });
|
|
39
|
+
}}
|
|
33
40
|
/>
|
|
34
41
|
</Wrapper>
|
|
35
42
|
);
|
|
@@ -38,7 +45,10 @@ export const Feedback = (props: FeedbackProps & { path?: string }) => {
|
|
|
38
45
|
<Wrapper>
|
|
39
46
|
<Comment
|
|
40
47
|
settings={settings}
|
|
41
|
-
onSubmit={(values) =>
|
|
48
|
+
onSubmit={(values) => {
|
|
49
|
+
submitFeedback({ type: 'comment', values, path });
|
|
50
|
+
telemetry.send('feedback_sent', { type: 'comment' });
|
|
51
|
+
}}
|
|
42
52
|
/>
|
|
43
53
|
</Wrapper>
|
|
44
54
|
);
|
|
@@ -116,5 +116,9 @@ const Star = styled.span`
|
|
|
116
116
|
|
|
117
117
|
const Label = styled.h3`
|
|
118
118
|
margin-right: 15px;
|
|
119
|
-
font-family: var(--font-family
|
|
119
|
+
font-family: var(--h3-font-family);
|
|
120
|
+
font-weight: var(--h3-font-weight);
|
|
121
|
+
font-size: var(--h3-font-size);
|
|
122
|
+
line-height: var(--h3-line-height);
|
|
123
|
+
color: var(--h3-text-color);
|
|
120
124
|
`;
|
|
@@ -77,6 +77,11 @@ const Wrapper = styled.div`
|
|
|
77
77
|
`;
|
|
78
78
|
|
|
79
79
|
const Label = styled.h3`
|
|
80
|
+
font-family: var(--h3-font-family);
|
|
81
|
+
font-weight: var(--h3-font-weight);
|
|
82
|
+
font-size: var(--h3-font-size);
|
|
83
|
+
line-height: var(--h3-line-height);
|
|
84
|
+
color: var(--h3-text-color);
|
|
80
85
|
margin-right: 15px;
|
|
81
86
|
`;
|
|
82
87
|
|
|
@@ -69,10 +69,18 @@ export const Sentiment = ({ settings, onSubmit, className }: SentimentProps): JS
|
|
|
69
69
|
<Label data-translation-key={translationKeys.label}>
|
|
70
70
|
{translate(translationKeys.label, label || 'Was this page helpful?')}
|
|
71
71
|
</Label>
|
|
72
|
-
<Vote
|
|
72
|
+
<Vote
|
|
73
|
+
onClick={() => {
|
|
74
|
+
setScore(1);
|
|
75
|
+
}}
|
|
76
|
+
>
|
|
73
77
|
<ThumbUp text="Yes" />
|
|
74
78
|
</Vote>
|
|
75
|
-
<Vote
|
|
79
|
+
<Vote
|
|
80
|
+
onClick={() => {
|
|
81
|
+
setScore(-1);
|
|
82
|
+
}}
|
|
83
|
+
>
|
|
76
84
|
<ThumbDown />
|
|
77
85
|
</Vote>
|
|
78
86
|
</Wrapper>
|
|
@@ -86,6 +94,11 @@ const Wrapper = styled.div`
|
|
|
86
94
|
`;
|
|
87
95
|
|
|
88
96
|
const Label = styled.h3`
|
|
97
|
+
font-family: var(--h3-font-family);
|
|
98
|
+
font-weight: var(--h3-font-weight);
|
|
99
|
+
font-size: var(--h3-font-size);
|
|
100
|
+
line-height: var(--h3-line-height);
|
|
101
|
+
color: var(--h3-text-color);
|
|
89
102
|
margin-right: 15px;
|
|
90
103
|
`;
|
|
91
104
|
|
|
@@ -108,12 +108,12 @@ export const ThumbDown = ({ text }: { text?: string }) => {
|
|
|
108
108
|
const Wrapper = styled.div`
|
|
109
109
|
font-family: var(--font-family-base);
|
|
110
110
|
display: flex;
|
|
111
|
-
color: var(--color-
|
|
111
|
+
color: var(--color-info-text);
|
|
112
112
|
&:hover {
|
|
113
|
-
color: var(--color-
|
|
113
|
+
color: var(--color-info-text-active);
|
|
114
114
|
svg {
|
|
115
115
|
> g {
|
|
116
|
-
fill: var(--color-
|
|
116
|
+
fill: var(--color-info-text-active);
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
119
|
}
|
|
@@ -125,7 +125,7 @@ const Icon = styled.div`
|
|
|
125
125
|
margin-right: 5px;
|
|
126
126
|
> svg {
|
|
127
127
|
> g {
|
|
128
|
-
fill: var(--color-
|
|
128
|
+
fill: var(--color-info-text);
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
131
|
`;
|
|
@@ -9,7 +9,13 @@ import { useTranslate } from '@portal/hooks';
|
|
|
9
9
|
import { CheckboxIcon } from '@theme/icons';
|
|
10
10
|
import { Select } from '@theme/components/Select';
|
|
11
11
|
|
|
12
|
-
export function Filter({
|
|
12
|
+
export function Filter({
|
|
13
|
+
filter,
|
|
14
|
+
filterValuesCasing,
|
|
15
|
+
}: {
|
|
16
|
+
filter: ResolvedFilter & { selectedOptions: any };
|
|
17
|
+
filterValuesCasing?: 'sentence';
|
|
18
|
+
}) {
|
|
13
19
|
const { translate } = useTranslate();
|
|
14
20
|
const translationKeys = {
|
|
15
21
|
selectAll: 'theme.catalog.filters.select.all',
|
|
@@ -44,7 +50,9 @@ export function Filter({ filter }: { filter: ResolvedFilter & { selectedOptions:
|
|
|
44
50
|
role="link"
|
|
45
51
|
onClick={() => filter.selectOption(option.value)}
|
|
46
52
|
>
|
|
47
|
-
<FilterOptionLabel>
|
|
53
|
+
<FilterOptionLabel>
|
|
54
|
+
{changeCasing(translate(option.value), filterValuesCasing)}
|
|
55
|
+
</FilterOptionLabel>
|
|
48
56
|
<FilterOptionCount>{option.count}</FilterOptionCount>
|
|
49
57
|
</FilterOption>
|
|
50
58
|
),
|
|
@@ -65,6 +73,7 @@ export function Filter({ filter }: { filter: ResolvedFilter & { selectedOptions:
|
|
|
65
73
|
<FilterTitle>{translate(filter.titleTranslationKey, filter.title)} </FilterTitle>
|
|
66
74
|
{filter.type === 'select' ? (
|
|
67
75
|
<StyledSelect
|
|
76
|
+
withArrow={true}
|
|
68
77
|
selected={selectedOptionComponent}
|
|
69
78
|
options={selectOptions.map((option) => option.component)}
|
|
70
79
|
/>
|
|
@@ -119,7 +128,9 @@ export function Filter({ filter }: { filter: ResolvedFilter & { selectedOptions:
|
|
|
119
128
|
return (
|
|
120
129
|
<FilterOption key={id} role="link" onClick={() => filter.toggleOption(value.value)}>
|
|
121
130
|
<CheckboxIcon checked={filter.selectedOptions.has(value.value)} />
|
|
122
|
-
<FilterOptionLabel>
|
|
131
|
+
<FilterOptionLabel>
|
|
132
|
+
{changeCasing(translate(value.value), filterValuesCasing)}
|
|
133
|
+
</FilterOptionLabel>
|
|
123
134
|
<FilterOptionCount>{value.count}</FilterOptionCount>
|
|
124
135
|
</FilterOption>
|
|
125
136
|
);
|
|
@@ -129,6 +140,13 @@ export function Filter({ filter }: { filter: ResolvedFilter & { selectedOptions:
|
|
|
129
140
|
);
|
|
130
141
|
}
|
|
131
142
|
|
|
143
|
+
function changeCasing(str: string, casing?: 'sentence') {
|
|
144
|
+
if (casing !== 'sentence') return str;
|
|
145
|
+
|
|
146
|
+
const words = str.split(/[\s-_]+/);
|
|
147
|
+
return words.map((word) => word[0].toUpperCase() + word.slice(1).toLowerCase()).join(' ');
|
|
148
|
+
}
|
|
149
|
+
|
|
132
150
|
const FilterGroup = styled.div`
|
|
133
151
|
padding: var(--filter-group-padding);
|
|
134
152
|
`;
|
|
@@ -139,6 +157,9 @@ const FilterOptionLabel = styled.label`
|
|
|
139
157
|
font-weight: var(--filter-option-label-font-weight);
|
|
140
158
|
margin: var(--filter-option-label-margin);
|
|
141
159
|
color: var(--filter-option-label-color);
|
|
160
|
+
white-space: nowrap;
|
|
161
|
+
text-overflow: ellipsis;
|
|
162
|
+
overflow: hidden;
|
|
142
163
|
`;
|
|
143
164
|
|
|
144
165
|
const FilterOptionCount = styled.label`
|
|
@@ -162,7 +183,7 @@ const FilterTitle = styled.h4`
|
|
|
162
183
|
margin: var(--filter-title-margin);
|
|
163
184
|
`;
|
|
164
185
|
|
|
165
|
-
const FilterOption = styled.label`
|
|
186
|
+
const FilterOption = styled.label.attrs({ 'data-cy': 'Filter/FilterOption' })`
|
|
166
187
|
display: flex;
|
|
167
188
|
align-items: center;
|
|
168
189
|
cursor: pointer;
|