@teambit/component 0.0.555 → 0.0.556
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 +40 -34
- package/aspect-entry.ts +0 -67
- package/aspect-list.ts +0 -100
- package/aspect.section.tsx +0 -16
- package/component-factory.ts +0 -106
- package/component-fs.ts +0 -60
- package/component-map/component-map.ts +0 -106
- package/component-map/index.ts +0 -1
- package/component-meta.ts +0 -29
- package/component.aspect.ts +0 -9
- package/component.docs.mdx +0 -8
- package/component.graphql.ts +0 -202
- package/component.main.runtime.ts +0 -162
- package/component.route.ts +0 -26
- package/component.ts +0 -278
- package/component.ui.runtime.tsx +0 -216
- package/config.ts +0 -34
- package/dependencies/dependencies.ts +0 -74
- package/dependencies/index.ts +0 -1
- package/exceptions/could-not-find-latest.ts +0 -8
- package/exceptions/host-not-found.ts +0 -14
- package/exceptions/index.ts +0 -4
- package/exceptions/nothing-to-snap.ts +0 -1
- package/hash.ts +0 -4
- package/head.ts +0 -0
- package/history-graph.ts +0 -1
- package/host/component-host-model.ts +0 -9
- package/host/index.ts +0 -2
- package/host/use-component-host.ts +0 -39
- package/index.ts +0 -32
- package/on-load.ts +0 -0
- package/package-tar/teambit-component-0.0.555.tgz +0 -0
- package/section/index.ts +0 -1
- package/section/section.tsx +0 -8
- package/show/extensions.fragment.ts +0 -23
- package/show/files.fragment.ts +0 -24
- package/show/id.fragment.ts +0 -20
- package/show/index.ts +0 -8
- package/show/main-file.fragment.ts +0 -13
- package/show/name.fragment.ts +0 -13
- package/show/scope.fragment.ts +0 -15
- package/show/show-fragment.ts +0 -44
- package/show/show.cmd.ts +0 -85
- package/snap/author.ts +0 -19
- package/snap/index.ts +0 -2
- package/snap/snap.ts +0 -63
- package/state.ts +0 -73
- package/store.ts +0 -3
- package/tag/index.ts +0 -1
- package/tag/tag.ts +0 -37
- package/tag-map.ts +0 -87
- package/tsconfig.json +0 -34
- package/types/asset.d.ts +0 -29
- package/types/style.d.ts +0 -42
- package/ui/aspect-page/aspect-page.module.scss +0 -20
- package/ui/aspect-page/aspect-page.tsx +0 -64
- package/ui/aspect-page/index.ts +0 -1
- package/ui/component-error/component-error.tsx +0 -22
- package/ui/component-error/index.ts +0 -1
- package/ui/component-model/component-model.ts +0 -169
- package/ui/component-model/index.ts +0 -1
- package/ui/component.module.scss +0 -7
- package/ui/component.tsx +0 -48
- package/ui/context/component-context.ts +0 -5
- package/ui/context/component-provider.tsx +0 -20
- package/ui/context/index.ts +0 -2
- package/ui/index.ts +0 -3
- package/ui/menu/index.ts +0 -2
- package/ui/menu/menu-nav.tsx +0 -37
- package/ui/menu/menu.module.scss +0 -62
- package/ui/menu/menu.tsx +0 -94
- package/ui/menu/nav-plugin.tsx +0 -9
- package/ui/top-bar-nav/index.ts +0 -1
- package/ui/top-bar-nav/top-bar-nav.module.scss +0 -52
- package/ui/top-bar-nav/top-bar-nav.tsx +0 -26
- package/ui/use-component-query.ts +0 -195
- package/ui/use-component.tsx +0 -34
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
import { Composition, CompositionProps } from '@teambit/compositions';
|
|
2
|
-
import { DeprecationInfo } from '@teambit/deprecation';
|
|
3
|
-
import { Descriptor } from '@teambit/envs';
|
|
4
|
-
import { ComponentID, ComponentIdObj } from '@teambit/component-id';
|
|
5
|
-
|
|
6
|
-
import { Tag } from '../../tag';
|
|
7
|
-
import { TagMap } from '../../tag-map';
|
|
8
|
-
import { TagProps } from '../../tag/tag';
|
|
9
|
-
// import { Snap } from '../../snap';
|
|
10
|
-
|
|
11
|
-
// ADDING MORE PROPERTIES HERE IS NOT ALLOWED!!! IF YOU NEED DATA PLEASE ADD A NEW
|
|
12
|
-
// HOOK FROM YOUR ASPECT!!!
|
|
13
|
-
// TODO: remove all properties from here to their rightful place in their aspects.
|
|
14
|
-
export type ComponentModelProps = {
|
|
15
|
-
id: ComponentIdObj;
|
|
16
|
-
description: string;
|
|
17
|
-
buildStatus?: string;
|
|
18
|
-
server?: ComponentServer;
|
|
19
|
-
displayName: string;
|
|
20
|
-
packageName: string; // pkg aspect
|
|
21
|
-
elementsUrl?: string; // pkg aspect
|
|
22
|
-
compositions?: CompositionProps[];
|
|
23
|
-
tags?: TagProps[];
|
|
24
|
-
issuesCount?: number; // component/issues aspect
|
|
25
|
-
status?: any; // workspace aspect.
|
|
26
|
-
deprecation?: DeprecationInfo; // deprecation aspect
|
|
27
|
-
env?: Descriptor; // env aspect.
|
|
28
|
-
labels?: string[];
|
|
29
|
-
host?: string;
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
export type ComponentServer = {
|
|
33
|
-
env: string;
|
|
34
|
-
url: string;
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
export class ComponentModel {
|
|
38
|
-
constructor(
|
|
39
|
-
/**
|
|
40
|
-
* id of the component
|
|
41
|
-
*/
|
|
42
|
-
readonly id: ComponentID,
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* display name of the component.
|
|
46
|
-
*/
|
|
47
|
-
readonly displayName: string,
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* package name of the component.
|
|
51
|
-
*/
|
|
52
|
-
readonly packageName: string,
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* the component server.
|
|
56
|
-
*/
|
|
57
|
-
readonly server: ComponentServer | undefined,
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* array of compositions
|
|
61
|
-
*/
|
|
62
|
-
readonly compositions: Composition[],
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* tags of the component.
|
|
66
|
-
*/
|
|
67
|
-
readonly tags: TagMap,
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* component build status
|
|
71
|
-
*/
|
|
72
|
-
readonly buildStatus?: string,
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* issues of component.
|
|
76
|
-
*/
|
|
77
|
-
readonly issuesCount?: number,
|
|
78
|
-
/**
|
|
79
|
-
* elements url
|
|
80
|
-
*/
|
|
81
|
-
readonly elementsUrl?: string,
|
|
82
|
-
/**
|
|
83
|
-
* status of component.
|
|
84
|
-
*/
|
|
85
|
-
readonly status?: any,
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* deprecation info of the component.
|
|
89
|
-
*/
|
|
90
|
-
readonly deprecation?: DeprecationInfo,
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* env descriptor.
|
|
94
|
-
*/
|
|
95
|
-
readonly environment?: Descriptor,
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* description of the component.
|
|
99
|
-
*/
|
|
100
|
-
|
|
101
|
-
readonly description = '',
|
|
102
|
-
|
|
103
|
-
readonly labels: string[] = [],
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* host of the component
|
|
107
|
-
*/
|
|
108
|
-
readonly host?: string
|
|
109
|
-
) {}
|
|
110
|
-
|
|
111
|
-
get version() {
|
|
112
|
-
if (!this.id.version) return 'new';
|
|
113
|
-
return this.id.version;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
* create an instance of a component from a plain object.
|
|
118
|
-
*/
|
|
119
|
-
static from({
|
|
120
|
-
id,
|
|
121
|
-
server,
|
|
122
|
-
displayName,
|
|
123
|
-
compositions = [],
|
|
124
|
-
packageName,
|
|
125
|
-
elementsUrl,
|
|
126
|
-
tags = [],
|
|
127
|
-
deprecation,
|
|
128
|
-
buildStatus,
|
|
129
|
-
env,
|
|
130
|
-
status,
|
|
131
|
-
issuesCount,
|
|
132
|
-
description,
|
|
133
|
-
labels,
|
|
134
|
-
host,
|
|
135
|
-
}: ComponentModelProps) {
|
|
136
|
-
return new ComponentModel(
|
|
137
|
-
ComponentID.fromObject(id),
|
|
138
|
-
displayName,
|
|
139
|
-
packageName,
|
|
140
|
-
server,
|
|
141
|
-
Composition.fromArray(compositions),
|
|
142
|
-
TagMap.fromArray(tags.map((tag) => Tag.fromObject(tag))),
|
|
143
|
-
buildStatus,
|
|
144
|
-
issuesCount,
|
|
145
|
-
elementsUrl,
|
|
146
|
-
status,
|
|
147
|
-
deprecation,
|
|
148
|
-
env,
|
|
149
|
-
description,
|
|
150
|
-
labels,
|
|
151
|
-
host
|
|
152
|
-
);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
static fromArray(componentsProps: ComponentModelProps[]) {
|
|
156
|
-
return componentsProps.map((rawComponent) => ComponentModel.from(rawComponent));
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
static empty() {
|
|
160
|
-
return new ComponentModel(
|
|
161
|
-
ComponentID.fromObject({ name: 'root', scope: 'temp' }),
|
|
162
|
-
'',
|
|
163
|
-
'',
|
|
164
|
-
{ env: '', url: '' },
|
|
165
|
-
[],
|
|
166
|
-
TagMap.empty()
|
|
167
|
-
);
|
|
168
|
-
}
|
|
169
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { ComponentModel, ComponentModelProps } from './component-model';
|
package/ui/component.module.scss
DELETED
package/ui/component.tsx
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, ReactNode, useMemo } from 'react';
|
|
2
|
-
import flatten from 'lodash.flatten';
|
|
3
|
-
import { RouteSlot, SlotSubRouter } from '@teambit/ui-foundation.ui.react-router.slot-router';
|
|
4
|
-
import { SlotRegistry } from '@teambit/harmony';
|
|
5
|
-
|
|
6
|
-
import styles from './component.module.scss';
|
|
7
|
-
import { ComponentProvider } from './context';
|
|
8
|
-
import { useComponent } from './use-component';
|
|
9
|
-
import { ComponentModel } from './component-model';
|
|
10
|
-
|
|
11
|
-
export type ComponentPageSlot = SlotRegistry<ComponentPageElement[]>;
|
|
12
|
-
export type ComponentPageElement = {
|
|
13
|
-
type: 'before' | 'after';
|
|
14
|
-
content: ReactNode;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export type ComponentProps = {
|
|
18
|
-
containerSlot?: ComponentPageSlot;
|
|
19
|
-
routeSlot: RouteSlot;
|
|
20
|
-
host: string;
|
|
21
|
-
onComponentChange?: (activeComponent?: ComponentModel) => void;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* main UI component of the Component extension.
|
|
26
|
-
*/
|
|
27
|
-
export function Component({ routeSlot, containerSlot, host, onComponentChange }: ComponentProps) {
|
|
28
|
-
const { component, error } = useComponent(host);
|
|
29
|
-
// trigger onComponentChange when component changes
|
|
30
|
-
useEffect(() => onComponentChange?.(component), [component]);
|
|
31
|
-
// cleanup when unmounting component
|
|
32
|
-
useEffect(() => () => onComponentChange?.(undefined), []);
|
|
33
|
-
|
|
34
|
-
const pageItems = useMemo(() => flatten(containerSlot?.values()), [containerSlot]);
|
|
35
|
-
const before = useMemo(() => pageItems.filter((x) => x.type === 'before').map((x) => x.content), [pageItems]);
|
|
36
|
-
const after = useMemo(() => pageItems.filter((x) => x.type === 'after').map((x) => x.content), [pageItems]);
|
|
37
|
-
|
|
38
|
-
if (error) return error.renderError();
|
|
39
|
-
if (!component) return <div></div>;
|
|
40
|
-
|
|
41
|
-
return (
|
|
42
|
-
<ComponentProvider component={component}>
|
|
43
|
-
{before}
|
|
44
|
-
<div className={styles.container}>{routeSlot && <SlotSubRouter slot={routeSlot} />}</div>
|
|
45
|
-
{after}
|
|
46
|
-
</ComponentProvider>
|
|
47
|
-
);
|
|
48
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import React, { ReactNode } from 'react';
|
|
2
|
-
|
|
3
|
-
import { ComponentModel } from '../component-model';
|
|
4
|
-
import { ComponentContext } from './component-context';
|
|
5
|
-
|
|
6
|
-
export type ComponentProviderProps = {
|
|
7
|
-
/**
|
|
8
|
-
* component model.
|
|
9
|
-
*/
|
|
10
|
-
component: ComponentModel;
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* component children.
|
|
14
|
-
*/
|
|
15
|
-
children: ReactNode;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export function ComponentProvider({ component, children }: ComponentProviderProps) {
|
|
19
|
-
return <ComponentContext.Provider value={component}>{children}</ComponentContext.Provider>;
|
|
20
|
-
}
|
package/ui/context/index.ts
DELETED
package/ui/index.ts
DELETED
package/ui/menu/index.ts
DELETED
package/ui/menu/menu-nav.tsx
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
import { TopBarNav } from '../top-bar-nav';
|
|
4
|
-
import styles from './menu.module.scss';
|
|
5
|
-
import { NavPlugin, OrderedNavigationSlot } from './nav-plugin';
|
|
6
|
-
|
|
7
|
-
export function MenuNav({ navigationSlot }: { navigationSlot: OrderedNavigationSlot }) {
|
|
8
|
-
const plugins = navigationSlot.toArray().sort(sortFn);
|
|
9
|
-
|
|
10
|
-
return (
|
|
11
|
-
<nav className={styles.navigation}>
|
|
12
|
-
{plugins.map(([id, menuItem]) => (
|
|
13
|
-
<TopBarNav key={id} {...menuItem.props} />
|
|
14
|
-
))}
|
|
15
|
-
</nav>
|
|
16
|
-
);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function sortFn([, { order: first }]: [string, NavPlugin], [, { order: second }]: [string, NavPlugin]) {
|
|
20
|
-
// 0 - equal
|
|
21
|
-
// <0 - first < second
|
|
22
|
-
// >0 - first > second
|
|
23
|
-
|
|
24
|
-
return (first ?? 0) - (second ?? 0);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
// // this is the aspect-oriented and serialize-able way to sort plugins.
|
|
28
|
-
// const pluginOrder = ['teambit.docs/docs', 'teambit.compositions/compositions', 'teambit.docs/docs'];
|
|
29
|
-
// export function toSortedArray<T>(slot: SlotRegistry<T>, order: string[]) {
|
|
30
|
-
// // sort items according to the order
|
|
31
|
-
// const sorted = order.map((x) => [x, slot.get(x)]).filter(([, val]) => !!val) as [string, T][];
|
|
32
|
-
//
|
|
33
|
-
// // add all other items
|
|
34
|
-
// const unsorted = slot.toArray().filter(([id]) => order.indexOf(id) < 0);
|
|
35
|
-
//
|
|
36
|
-
// return sorted.concat(unsorted);
|
|
37
|
-
// }
|
package/ui/menu/menu.module.scss
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
.topBar {
|
|
2
|
-
display: flex;
|
|
3
|
-
justify-content: space-between;
|
|
4
|
-
align-items: center;
|
|
5
|
-
width: 100%;
|
|
6
|
-
height: 100%;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
.leftSide {
|
|
10
|
-
display: flex;
|
|
11
|
-
align-items: center;
|
|
12
|
-
height: 100%;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
.navigation {
|
|
16
|
-
display: flex;
|
|
17
|
-
list-style: none;
|
|
18
|
-
height: 100%;
|
|
19
|
-
padding-left: 28px;
|
|
20
|
-
@media screen and (max-width: 768px) {
|
|
21
|
-
padding-left: 6px;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
> li {
|
|
25
|
-
display: block;
|
|
26
|
-
margin-right: 16px;
|
|
27
|
-
height: 100%;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
.rightSide {
|
|
32
|
-
display: flex;
|
|
33
|
-
align-items: center;
|
|
34
|
-
height: 100%;
|
|
35
|
-
> * {
|
|
36
|
-
margin-right: 12px;
|
|
37
|
-
&:last-child {
|
|
38
|
-
margin-right: 16px;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
.widgets {
|
|
42
|
-
height: 100%;
|
|
43
|
-
margin-right: 20px;
|
|
44
|
-
display: flex;
|
|
45
|
-
align-items: center;
|
|
46
|
-
> nav {
|
|
47
|
-
> a {
|
|
48
|
-
padding: 0;
|
|
49
|
-
&:last-child {
|
|
50
|
-
margin-right: 0;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
.widget {
|
|
56
|
-
font-size: 17px;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
.useBox {
|
|
61
|
-
--bit-drawer-margin: 14px;
|
|
62
|
-
}
|
package/ui/menu/menu.tsx
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import { MainDropdown, MenuItemSlot } from '@teambit/ui-foundation.ui.main-dropdown';
|
|
2
|
-
import { VersionDropdown } from '@teambit/component.ui.version-dropdown';
|
|
3
|
-
import { FullLoader } from '@teambit/legacy/dist/to-eject/full-loader';
|
|
4
|
-
import { flatten, groupBy } from 'lodash';
|
|
5
|
-
import classnames from 'classnames';
|
|
6
|
-
import React, { useMemo } from 'react';
|
|
7
|
-
import { UseBoxDropdown } from '@teambit/ui-foundation.ui.use-box.dropdown';
|
|
8
|
-
import { Menu as UseBoxMenu } from '@teambit/ui-foundation.ui.use-box.menu';
|
|
9
|
-
import type { ComponentModel } from '../component-model';
|
|
10
|
-
import { useComponent } from '../use-component';
|
|
11
|
-
import { MenuNav } from './menu-nav';
|
|
12
|
-
import styles from './menu.module.scss';
|
|
13
|
-
import { OrderedNavigationSlot } from './nav-plugin';
|
|
14
|
-
|
|
15
|
-
export type MenuProps = {
|
|
16
|
-
className?: string;
|
|
17
|
-
/**
|
|
18
|
-
* slot for top bar menu nav items
|
|
19
|
-
*/
|
|
20
|
-
navigationSlot: OrderedNavigationSlot;
|
|
21
|
-
/**
|
|
22
|
-
* right side menu item slot
|
|
23
|
-
*/
|
|
24
|
-
widgetSlot: OrderedNavigationSlot;
|
|
25
|
-
host: string;
|
|
26
|
-
/**
|
|
27
|
-
* main dropdown item slot
|
|
28
|
-
*/
|
|
29
|
-
menuItemSlot: MenuItemSlot;
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* top bar menu.
|
|
34
|
-
*/
|
|
35
|
-
export function Menu({ navigationSlot, widgetSlot, className, host, menuItemSlot }: MenuProps) {
|
|
36
|
-
const { component } = useComponent(host);
|
|
37
|
-
const mainMenuItems = useMemo(() => groupBy(flatten(menuItemSlot.values()), 'category'), [menuItemSlot]);
|
|
38
|
-
|
|
39
|
-
if (!component) return <FullLoader />;
|
|
40
|
-
|
|
41
|
-
return (
|
|
42
|
-
<div className={classnames(styles.topBar, className)}>
|
|
43
|
-
<div className={styles.leftSide}>
|
|
44
|
-
<MenuNav navigationSlot={navigationSlot} />
|
|
45
|
-
</div>
|
|
46
|
-
<div className={styles.rightSide}>
|
|
47
|
-
<div className={styles.widgets}>
|
|
48
|
-
<MenuNav navigationSlot={widgetSlot} />
|
|
49
|
-
</div>
|
|
50
|
-
<VersionRelatedDropdowns component={component} />
|
|
51
|
-
<MainDropdown menuItems={mainMenuItems} />
|
|
52
|
-
</div>
|
|
53
|
-
</div>
|
|
54
|
-
);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
function VersionRelatedDropdowns({ component }: { component: ComponentModel }) {
|
|
58
|
-
const versionList =
|
|
59
|
-
useMemo(
|
|
60
|
-
() =>
|
|
61
|
-
component.tags
|
|
62
|
-
?.toArray()
|
|
63
|
-
.map((tag) => tag?.version?.version)
|
|
64
|
-
.filter((x) => x !== undefined)
|
|
65
|
-
.reverse(),
|
|
66
|
-
[component.tags]
|
|
67
|
-
) || [];
|
|
68
|
-
|
|
69
|
-
const isLatestVersion = useMemo(() => component.version === versionList[0], [component.version]);
|
|
70
|
-
const packageVersion = useMemo(() => (isLatestVersion ? '' : `@${component.version}`), [component.version]);
|
|
71
|
-
const origin = typeof window !== undefined ? window.location.origin : undefined;
|
|
72
|
-
const finalElementsUrl = origin && component.elementsUrl ? `${origin}${component.elementsUrl}` : undefined;
|
|
73
|
-
|
|
74
|
-
return (
|
|
75
|
-
<>
|
|
76
|
-
{versionList.length > 0 && (
|
|
77
|
-
<UseBoxDropdown
|
|
78
|
-
position="bottom-end"
|
|
79
|
-
className={styles.useBox}
|
|
80
|
-
Menu={() => (
|
|
81
|
-
<UseBoxMenu
|
|
82
|
-
componentName={component.id.name}
|
|
83
|
-
componentId={component.id.toString({ ignoreVersion: isLatestVersion })}
|
|
84
|
-
packageName={`${component.packageName}${packageVersion}`}
|
|
85
|
-
elementsUrl={finalElementsUrl}
|
|
86
|
-
registryName={component.packageName.split('/')[0]}
|
|
87
|
-
/>
|
|
88
|
-
)}
|
|
89
|
-
/>
|
|
90
|
-
)}
|
|
91
|
-
<VersionDropdown versions={versionList} currentVersion={component.version} />
|
|
92
|
-
</>
|
|
93
|
-
);
|
|
94
|
-
}
|
package/ui/menu/nav-plugin.tsx
DELETED
package/ui/top-bar-nav/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './top-bar-nav';
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
.topBarLink {
|
|
2
|
-
position: relative;
|
|
3
|
-
padding: 0 8px;
|
|
4
|
-
|
|
5
|
-
box-sizing: border-box;
|
|
6
|
-
|
|
7
|
-
display: flex;
|
|
8
|
-
align-items: center;
|
|
9
|
-
|
|
10
|
-
color: inherit;
|
|
11
|
-
text-decoration: none;
|
|
12
|
-
|
|
13
|
-
transition: color 300ms;
|
|
14
|
-
margin: 0 5px;
|
|
15
|
-
|
|
16
|
-
&:hover:not(.active) {
|
|
17
|
-
> div {
|
|
18
|
-
background-color: var(--bit-bg-heavy);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
&.active {
|
|
23
|
-
color: var(--bit-accent-color, #6c5ce7);
|
|
24
|
-
|
|
25
|
-
&:after {
|
|
26
|
-
background-color: var(--bit-accent-color, #6c5ce7);
|
|
27
|
-
height: 4px;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
&:after {
|
|
32
|
-
content: '';
|
|
33
|
-
position: absolute;
|
|
34
|
-
bottom: 0;
|
|
35
|
-
left: 0;
|
|
36
|
-
right: 0;
|
|
37
|
-
background-color: transparent;
|
|
38
|
-
height: 0;
|
|
39
|
-
border-top-right-radius: 2px;
|
|
40
|
-
border-top-left-radius: 2px;
|
|
41
|
-
transition: background-color 300ms, height 300ms;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
> div {
|
|
45
|
-
border-radius: 6px;
|
|
46
|
-
padding: 0 8px;
|
|
47
|
-
height: 30px;
|
|
48
|
-
display: flex;
|
|
49
|
-
align-items: center;
|
|
50
|
-
transition: background-color 300ms ease-in-out;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { NavLink, NavLinkProps } from '@teambit/base-ui.routing.nav-link';
|
|
2
|
-
import { extendPath } from '@teambit/ui-foundation.ui.react-router.extend-path';
|
|
3
|
-
import classnames from 'classnames';
|
|
4
|
-
import React from 'react';
|
|
5
|
-
import { useRouteMatch, useLocation } from 'react-router-dom';
|
|
6
|
-
|
|
7
|
-
import styles from './top-bar-nav.module.scss';
|
|
8
|
-
|
|
9
|
-
export function TopBarNav(props: NavLinkProps) {
|
|
10
|
-
const { url } = useRouteMatch();
|
|
11
|
-
const { search } = useLocation(); // sticky query params
|
|
12
|
-
const { href } = props;
|
|
13
|
-
|
|
14
|
-
const target = `${extendPath(url, href)}${search}`;
|
|
15
|
-
|
|
16
|
-
return (
|
|
17
|
-
<NavLink
|
|
18
|
-
{...props}
|
|
19
|
-
className={classnames(props.className, styles.topBarLink)}
|
|
20
|
-
activeClassName={classnames(props.className, styles.active)}
|
|
21
|
-
href={target}
|
|
22
|
-
>
|
|
23
|
-
<div>{props.children}</div>
|
|
24
|
-
</NavLink>
|
|
25
|
-
);
|
|
26
|
-
}
|