Skip to content
This repository was archived by the owner on Jun 13, 2024. It is now read-only.

Commit 5e09093

Browse files
JalexChenJaryt
andauthored
feat: added doc info #70 (#74)
Co-authored-by: Jaryt Bustard <jarytbustard@gmail.com>
1 parent b8b0830 commit 5e09093

18 files changed

Lines changed: 11044 additions & 27654 deletions

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
node_modules
22
build
3-
yarn-error.log
3+
yarn-error.log

package-lock.json

Lines changed: 0 additions & 17039 deletions
This file was deleted.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import ComponentMapping from '../../mappings/ComponentMapping';
2+
3+
const ComponentInfo = (props: { type: ComponentMapping }) => {
4+
return (
5+
<>
6+
<p className="font-medium text-sm text-circle-gray-500">{props.type.docsInfo.description}</p>
7+
<a className="ml-auto tracking-wide hover:underline leading-6 text-sm text-circle-blue font-medium" href={props.type.docsInfo.link}>Learn More</a><br></br>
8+
</>
9+
);
10+
};
11+
12+
export default ComponentInfo;

src/components/atoms/ConnectionLine.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const ConnectionLine = ({
1515
connectionLineStyle,
1616
}: ConnectionLineComponentProps) => {
1717
const connecting = useStoreState((state) => state.connecting);
18-
const transform = flowState((state) => state.transform);
18+
const transform = flowState((state: any) => state.transform);
1919
const handle = connecting?.start?.ref?.current as Element;
2020

2121
if (!handle) {

src/components/atoms/nodes/JobNode.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import React, { useRef } from 'react';
44
import { Handle, isNode, NodeProps, Position } from 'react-flow-renderer';
55
import JobIcon from '../../../icons/components/JobIcon';
66
import DeleteItemIcon from '../../../icons/ui/DeleteItemIcon';
7-
import DragItemIcon from '../../../icons/ui/DragItemIcon';
87
import PlusIcon from '../../../icons/ui/PlusIcon';
98
import JobMapping from '../../../mappings/JobMapping';
109
import { useStoreActions, useStoreState } from '../../../state/Hooks';

src/components/containers/DefinitionsContainer.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
CreateDefinitionMenuNav,
88
} from '../menus/definitions/CreateDefinitionMenu';
99
import SubTypeMenuNav from '../menus/SubTypeMenu';
10+
import ComponentInfo from '../atoms/ComponentInfo';
1011

1112
export interface DefinitionsProps {
1213
type: ComponentMapping;
@@ -18,6 +19,7 @@ const DefinitionsContainer = (props: DefinitionsProps) => {
1819
const items = useStoreState(props.type.store.get);
1920
const navigateTo = useStoreActions((actions) => actions.navigateTo);
2021

22+
console.log(props, 'props')
2123
return (
2224
<div className="w-full p-4 pb-0">
2325
<CollapsibleList
@@ -50,6 +52,7 @@ const DefinitionsContainer = (props: DefinitionsProps) => {
5052
}
5153
>
5254
<div className="w-full pl-2 pt-2">
55+
<ComponentInfo type={props.type} />
5356
{(items || []).length > 0 ? (
5457
items?.map((item) => (
5558
<Definition data={item} key={item.name} type={props.type} />

src/components/containers/inspector/subtypes/ExecutorSubtypes.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import InspectorProperty from '../../../atoms/form/InspectorProperty';
44
export interface ExecutorSubTypes {
55
[type: string]: SubTypeMapping & {
66
resourceClasses: string[];
7-
};
7+
};
88
}
99

1010
const executorSubtypes: ExecutorSubTypes = {
@@ -22,25 +22,29 @@ const executorSubtypes: ExecutorSubTypes = {
2222
fields: (
2323
<InspectorProperty label="Image" name="executor.image.image" required />
2424
),
25+
docsLink: 'https://circleci.com/docs/2.0/executor-types/#using-docker',
2526
description: 'Steps run in container with provided image',
2627
},
2728
machine: {
2829
text: 'Machine',
2930
resourceClasses: ['medium', 'large', 'xlarge', '2xlarge'],
3031
fields: <InspectorProperty label="Image" name="executor.image" required />,
32+
docsLink: 'https://circleci.com/docs/2.0/executor-types/#using-machine',
3133
description: 'Steps run on Linux Virtual Machine',
3234
},
3335
macos: {
3436
text: 'MacOS',
3537
resourceClasses: ['medium', 'large'],
3638
fields: <InspectorProperty label="Xcode" name="executor.xcode" required />,
39+
docsLink: 'https://circleci.com/docs/2.0/executor-types/#using-macos',
3740
description:
3841
'Steps run on macOS Virtual Machine with specific Xcode version',
3942
},
4043
windows: {
4144
text: 'Windows',
4245
resourceClasses: ['medium', 'large', 'xlarge', '2xlarge'],
4346
fields: <InspectorProperty label="Image" name="executor.image" required />,
47+
docsLink: 'https://circleci.com/docs/2.0/executor-types/#using-the-windows-executor',
4448
description: 'Steps run on Windows Virtual Machine',
4549
},
4650
};

src/components/containers/inspector/subtypes/ParameterSubtypes.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
import { ReusableExecutor } from '@circleci/circleci-config-sdk/dist/src/lib/Components/Executor';
2-
import { AnyParameterLiteral } from '@circleci/circleci-config-sdk/dist/src/lib/Components/Parameters/types/CustomParameterLiterals.types';
3-
import { ReactElement } from 'react';
42
import { SubTypeMapping } from '../../../../mappings/ComponentMapping';
53
import InspectorProperty from '../../../atoms/form/InspectorProperty';
64

src/components/menus/definitions/subtypes/ExecutorTypePage.tsx

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,19 @@ const ExecutorTypePage = (props: SubTypeSelectPageProps<string>) => {
3232
props.setSubtype(subtype);
3333
}}
3434
>
35-
<p className="font-bold">{executorSubtypes[subtype].text}</p>
35+
36+
{/* TODO: break out into card components */}
37+
<div className="flex flex-row">
38+
<p className="font-bold">{executorSubtypes[subtype].text}</p>
39+
{executorSubtypes[subtype].docsLink && (
40+
<a
41+
className="ml-auto tracking-wide hover:underline leading-6 text-sm text-circle-blue font-medium"
42+
href={executorSubtypes[subtype].docsLink}
43+
>
44+
Learn More
45+
</a>
46+
)}
47+
</div>
3648
<p className="text-sm mt-1 leading-4 text-circle-gray-500">
3749
{executorSubtypes[subtype].description}
3850
</p>
@@ -47,7 +59,9 @@ const ExecutorTypePage = (props: SubTypeSelectPageProps<string>) => {
4759
const ExecutorTypePageNav: NavigationComponent = {
4860
Component: ExecutorTypePage,
4961
Label: (props: SubTypeSelectPageProps<string>) => <p>New Executor</p>,
50-
Icon: (props: SubTypeSelectPageProps<string>) => <ExecutorIcon className="w-6 h-8 py-2" />,
62+
Icon: (props: SubTypeSelectPageProps<string>) => (
63+
<ExecutorIcon className="w-6 h-8 py-2" />
64+
),
5165
};
5266

5367
export default ExecutorTypePageNav;

src/components/menus/definitions/subtypes/ParameterTypePage.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { AnyParameterLiteral } from '@circleci/circleci-config-sdk/dist/src/lib/Components/Parameters/types/CustomParameterLiterals.types';
21
import ParameterIcon from '../../../../icons/components/ParameterIcon';
32
import ComponentMapping from '../../../../mappings/ComponentMapping';
43
import { NavigationComponent } from '../../../../state/Store';
@@ -9,7 +8,7 @@ import {
98
} from '../../../containers/inspector/subtypes/ParameterSubtypes';
109
import { SubTypeSelectPageProps } from '../../SubTypeMenu';
1110

12-
const ParameterTypePage = <ParameterType extends AnyParameterLiteral>(
11+
const ParameterTypePage = (
1312
props: SubTypeSelectPageProps<string> & { component: ComponentMapping },
1413
) => {
1514
const parameters =

0 commit comments

Comments
 (0)