docs(nxdev): add type & simplify default notation (#11317)
This commit is contained in:
parent
bdd9807cc5
commit
f2167d99ad
@ -1,4 +1,4 @@
|
|||||||
export function AnnouncementBanner() {
|
export function AnnouncementBanner(): JSX.Element {
|
||||||
return (
|
return (
|
||||||
<div className="bg-slate-800">
|
<div className="bg-slate-800">
|
||||||
<div className="mx-auto max-w-7xl py-3 px-3 sm:px-6 lg:px-8">
|
<div className="mx-auto max-w-7xl py-3 px-3 sm:px-6 lg:px-8">
|
||||||
@ -36,5 +36,3 @@ export function AnnouncementBanner() {
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default AnnouncementBanner;
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import { ChevronRightIcon } from '@heroicons/react/solid';
|
import { ChevronRightIcon } from '@heroicons/react/solid';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
|
|
||||||
export function Breadcrumbs({ path }: { path: string }) {
|
export function Breadcrumbs({ path }: { path: string }): JSX.Element {
|
||||||
const cleanedPath = path.includes('?')
|
const cleanedPath = path.includes('?')
|
||||||
? path.slice(0, path.indexOf('?'))
|
? path.slice(0, path.indexOf('?'))
|
||||||
: path;
|
: path;
|
||||||
@ -72,5 +72,3 @@ export function Breadcrumbs({ path }: { path: string }) {
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default Breadcrumbs;
|
|
||||||
|
|||||||
@ -4,7 +4,7 @@ import Link from 'next/link';
|
|||||||
export interface FooterProps {
|
export interface FooterProps {
|
||||||
useDarkBackground?: boolean;
|
useDarkBackground?: boolean;
|
||||||
}
|
}
|
||||||
export function Footer({ useDarkBackground }: FooterProps) {
|
export function Footer({ useDarkBackground }: FooterProps): JSX.Element {
|
||||||
const navigation = {
|
const navigation = {
|
||||||
solutions: [
|
solutions: [
|
||||||
{ name: 'Nx', href: 'https://nx.dev' },
|
{ name: 'Nx', href: 'https://nx.dev' },
|
||||||
@ -289,5 +289,3 @@ export function Footer({ useDarkBackground }: FooterProps) {
|
|||||||
</footer>
|
</footer>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default Footer;
|
|
||||||
|
|||||||
@ -8,7 +8,7 @@ export interface HeaderProps {
|
|||||||
useDarkBackground?: boolean;
|
useDarkBackground?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function Header(props: HeaderProps) {
|
export function Header(props: HeaderProps): JSX.Element {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const isNxCloudDoc: boolean = router.asPath.startsWith('/nx-cloud');
|
const isNxCloudDoc: boolean = router.asPath.startsWith('/nx-cloud');
|
||||||
const isReferencesDoc: boolean = router.asPath.startsWith('/packages');
|
const isReferencesDoc: boolean = router.asPath.startsWith('/packages');
|
||||||
@ -182,5 +182,3 @@ export function Header(props: HeaderProps) {
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default Header;
|
|
||||||
|
|||||||
@ -21,7 +21,7 @@ export function NpxCreateNxWorkspaceAnimation({
|
|||||||
restartFunction,
|
restartFunction,
|
||||||
}: {
|
}: {
|
||||||
restartFunction: () => void;
|
restartFunction: () => void;
|
||||||
}) {
|
}): JSX.Element {
|
||||||
const npxCreateNxWorkspace = useAnimation();
|
const npxCreateNxWorkspace = useAnimation();
|
||||||
const wrapper = useAnimation();
|
const wrapper = useAnimation();
|
||||||
const firstLoading = useAnimation();
|
const firstLoading = useAnimation();
|
||||||
@ -663,7 +663,7 @@ export function NpxCreateNxWorkspaceAnimation({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function NpxCreateNxWorkspace() {
|
export function NpxCreateNxWorkspace(): JSX.Element {
|
||||||
const [isDisplayed, setIsDisplayed] = useState(true);
|
const [isDisplayed, setIsDisplayed] = useState(true);
|
||||||
|
|
||||||
const restart = () => {
|
const restart = () => {
|
||||||
@ -694,5 +694,3 @@ export function NpxCreateNxWorkspace() {
|
|||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default NpxCreateNxWorkspace;
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
export function NxUsersShowcase() {
|
export function NxUsersShowcase(): JSX.Element {
|
||||||
return (
|
return (
|
||||||
<div className="overflow-hidden py-4 px-4">
|
<div className="overflow-hidden py-4 px-4">
|
||||||
<div className="top-1 bottom-3 mx-auto w-60 text-center text-xs text-gray-400">
|
<div className="top-1 bottom-3 mx-auto w-60 text-center text-xs text-gray-400">
|
||||||
@ -1035,5 +1035,3 @@ export function NxUsersShowcase() {
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default NxUsersShowcase;
|
|
||||||
|
|||||||
@ -1,16 +0,0 @@
|
|||||||
import { render } from '@testing-library/react';
|
|
||||||
|
|
||||||
import PluginCard from './plugin-card';
|
|
||||||
|
|
||||||
describe('PluginCard', () => {
|
|
||||||
it('should render successfully', () => {
|
|
||||||
const { baseElement } = render(
|
|
||||||
<PluginCard
|
|
||||||
name={'my plugin'}
|
|
||||||
description={'some description'}
|
|
||||||
url={'nx.dev'}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
expect(baseElement).toBeTruthy();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@ -1,5 +1,3 @@
|
|||||||
import { ReactComponentElement } from 'react';
|
|
||||||
|
|
||||||
export interface PluginCardProps {
|
export interface PluginCardProps {
|
||||||
name: string;
|
name: string;
|
||||||
description: string;
|
description: string;
|
||||||
@ -12,7 +10,7 @@ export function PluginCard({
|
|||||||
description,
|
description,
|
||||||
url,
|
url,
|
||||||
isOfficial,
|
isOfficial,
|
||||||
}: PluginCardProps): ReactComponentElement<any> {
|
}: PluginCardProps): JSX.Element {
|
||||||
return (
|
return (
|
||||||
<div className="focus-within:ring-blue-nx-base relative flex w-full overflow-hidden rounded-lg border border-gray-300 bg-white shadow-sm transition focus-within:ring-2 focus-within:ring-offset-2 hover:bg-gray-50">
|
<div className="focus-within:ring-blue-nx-base relative flex w-full overflow-hidden rounded-lg border border-gray-300 bg-white shadow-sm transition focus-within:ring-2 focus-within:ring-offset-2 hover:bg-gray-50">
|
||||||
<div className="flex w-full flex-col px-4 py-3">
|
<div className="flex w-full flex-col px-4 py-3">
|
||||||
@ -51,5 +49,3 @@ export function PluginCard({
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default PluginCard;
|
|
||||||
|
|||||||
@ -8,9 +8,7 @@ export interface SelectorProps<T> {
|
|||||||
onChange: (item: { label: string; value: string; data?: T }) => void;
|
onChange: (item: { label: string; value: string; data?: T }) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function Selector<T = {}>(
|
export function Selector<T = {}>(props: SelectorProps<T>): JSX.Element {
|
||||||
props: SelectorProps<T>
|
|
||||||
): ReactComponentElement<any> {
|
|
||||||
return (
|
return (
|
||||||
<div className="w-full">
|
<div className="w-full">
|
||||||
<Listbox
|
<Listbox
|
||||||
@ -87,5 +85,3 @@ export function Selector<T = {}>(
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default Selector;
|
|
||||||
|
|||||||
@ -2,17 +2,14 @@ import { Menu, MenuItem, MenuSection } from '@nrwl/nx-dev/models-menu';
|
|||||||
import cx from 'classnames';
|
import cx from 'classnames';
|
||||||
import Link from 'next/link';
|
import Link from 'next/link';
|
||||||
import { useRouter } from 'next/router';
|
import { useRouter } from 'next/router';
|
||||||
import { ReactComponentElement, useCallback, useState } from 'react';
|
import { useCallback, useState } from 'react';
|
||||||
|
|
||||||
export interface SidebarProps {
|
export interface SidebarProps {
|
||||||
menu: Menu;
|
menu: Menu;
|
||||||
navIsOpen?: boolean;
|
navIsOpen?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function Sidebar({
|
export function Sidebar({ menu, navIsOpen }: SidebarProps): JSX.Element {
|
||||||
menu,
|
|
||||||
navIsOpen,
|
|
||||||
}: SidebarProps): ReactComponentElement<any> {
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
data-testid="sidebar"
|
data-testid="sidebar"
|
||||||
@ -42,11 +39,7 @@ export function Sidebar({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function SidebarSection({
|
function SidebarSection({ section }: { section: MenuSection }): JSX.Element {
|
||||||
section,
|
|
||||||
}: {
|
|
||||||
section: MenuSection;
|
|
||||||
}): ReactComponentElement<any> {
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{section.hideSectionHeader ? null : (
|
{section.hideSectionHeader ? null : (
|
||||||
@ -68,11 +61,7 @@ function SidebarSection({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function SidebarSectionItems({
|
function SidebarSectionItems({ item }: { item: MenuItem }): JSX.Element {
|
||||||
item,
|
|
||||||
}: {
|
|
||||||
item: MenuItem;
|
|
||||||
}): ReactComponentElement<any> {
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const [collapsed, setCollapsed] = useState(!item.disableCollapsible);
|
const [collapsed, setCollapsed] = useState(!item.disableCollapsible);
|
||||||
|
|
||||||
@ -152,7 +141,7 @@ function CollapsibleIcon({
|
|||||||
isCollapsed,
|
isCollapsed,
|
||||||
}: {
|
}: {
|
||||||
isCollapsed: boolean;
|
isCollapsed: boolean;
|
||||||
}): ReactComponentElement<any> {
|
}): JSX.Element {
|
||||||
return (
|
return (
|
||||||
<svg
|
<svg
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
@ -173,5 +162,3 @@ function CollapsibleIcon({
|
|||||||
</svg>
|
</svg>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default Sidebar;
|
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
import { ReactComponentElement } from 'react';
|
|
||||||
|
|
||||||
interface Testimonial {
|
interface Testimonial {
|
||||||
author: string;
|
author: string;
|
||||||
title: string;
|
title: string;
|
||||||
@ -8,11 +6,7 @@ interface Testimonial {
|
|||||||
link: string;
|
link: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function TestimonialCard({
|
export function TestimonialCard({ data }: { data: Testimonial }): JSX.Element {
|
||||||
data,
|
|
||||||
}: {
|
|
||||||
data: Testimonial;
|
|
||||||
}): ReactComponentElement<any> {
|
|
||||||
return (
|
return (
|
||||||
<figure className="focus-within:ring-blue-nx-base relative flex flex-col-reverse rounded-lg border border-gray-300 bg-white p-6 text-sm shadow-sm transition focus-within:ring-2 focus-within:ring-offset-2 hover:bg-gray-50">
|
<figure className="focus-within:ring-blue-nx-base relative flex flex-col-reverse rounded-lg border border-gray-300 bg-white p-6 text-sm shadow-sm transition focus-within:ring-2 focus-within:ring-offset-2 hover:bg-gray-50">
|
||||||
<blockquote className="mt-6 text-slate-500">
|
<blockquote className="mt-6 text-slate-500">
|
||||||
@ -38,5 +32,3 @@ export function TestimonialCard({
|
|||||||
</figure>
|
</figure>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default TestimonialCard;
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user