Merge branch 'master' into tech-docs-search-by-title
Signed-off-by: Stephen <code@stephenawilson.ca>
This commit is contained in:
@@ -51,6 +51,14 @@ export type DocsTableProps = {
|
||||
options?: TableOptions<DocsTableRow>;
|
||||
};
|
||||
|
||||
const defaultColumns: TableColumn<DocsTableRow>[] = [
|
||||
columnFactories.createTitleColumn({ hidden: true }),
|
||||
columnFactories.createNameColumn(),
|
||||
columnFactories.createOwnerColumn(),
|
||||
columnFactories.createKindColumn(),
|
||||
columnFactories.createTypeColumn(),
|
||||
];
|
||||
|
||||
/**
|
||||
* Component which renders a table documents
|
||||
*
|
||||
@@ -84,14 +92,6 @@ export const DocsTable = (props: DocsTableProps) => {
|
||||
};
|
||||
});
|
||||
|
||||
const defaultColumns: TableColumn<DocsTableRow>[] = [
|
||||
columnFactories.createTitleColumn({ hidden: true }),
|
||||
columnFactories.createNameColumn(),
|
||||
columnFactories.createOwnerColumn(),
|
||||
columnFactories.createKindColumn(),
|
||||
columnFactories.createTypeColumn(),
|
||||
];
|
||||
|
||||
const defaultActions: TableProps<DocsTableRow>['actions'] = [
|
||||
actionFactories.createCopyDocsUrlAction(copyToClipboard),
|
||||
];
|
||||
|
||||
@@ -31,21 +31,12 @@ function customTitle(entity: Entity): string {
|
||||
*/
|
||||
export const columnFactories = {
|
||||
createTitleColumn(options?: { hidden?: boolean }): TableColumn<DocsTableRow> {
|
||||
const nameCol = columnFactories.createNameColumn()
|
||||
return {
|
||||
title: 'Document',
|
||||
...nameCol,
|
||||
field: 'entity.metadata.title',
|
||||
hidden: options?.hidden,
|
||||
highlight: true,
|
||||
searchable: true,
|
||||
render: (row: DocsTableRow) => (
|
||||
<SubvalueCell
|
||||
value={
|
||||
<Link to={row.resolved.docsUrl}>{customTitle(row.entity)}</Link>
|
||||
}
|
||||
subvalue={row.entity.metadata.description}
|
||||
/>
|
||||
),
|
||||
};
|
||||
}
|
||||
},
|
||||
createNameColumn(): TableColumn<DocsTableRow> {
|
||||
return {
|
||||
@@ -53,6 +44,12 @@ export const columnFactories = {
|
||||
field: 'entity.metadata.name',
|
||||
highlight: true,
|
||||
searchable: true,
|
||||
defaultSort: 'asc',
|
||||
customSort: (row1, row2) => {
|
||||
const title1 = customTitle(row1.entity).toLocaleLowerCase();
|
||||
const title2 = customTitle(row2.entity).toLocaleLowerCase();
|
||||
return title1.localeCompare(title2);
|
||||
},
|
||||
render: (row: DocsTableRow) => (
|
||||
<SubvalueCell
|
||||
value={
|
||||
|
||||
+1
-3
@@ -80,7 +80,6 @@ export const TechDocsReaderPageContent = withTechDocsReaderProvider(
|
||||
entityMetadata: { value: entityMetadata, loading: entityMetadataLoading },
|
||||
entityRef,
|
||||
setShadowRoot,
|
||||
incShadowRootVersion,
|
||||
} = useTechDocsReaderPage();
|
||||
const dom = useTechDocsReaderDom(entityRef);
|
||||
const path = window.location.pathname;
|
||||
@@ -103,12 +102,11 @@ export const TechDocsReaderPageContent = withTechDocsReaderProvider(
|
||||
const handleAppend = useCallback(
|
||||
(newShadowRoot: ShadowRoot) => {
|
||||
setShadowRoot(newShadowRoot);
|
||||
incShadowRootVersion();
|
||||
if (onReady instanceof Function) {
|
||||
onReady();
|
||||
}
|
||||
},
|
||||
[setShadowRoot, incShadowRootVersion, onReady],
|
||||
[setShadowRoot, onReady],
|
||||
);
|
||||
|
||||
// No entity metadata = 404. Don't render content at all.
|
||||
|
||||
@@ -74,6 +74,7 @@ export default ({ theme, sidebar }: RuleOptions) => `
|
||||
}
|
||||
.md-sidebar .md-sidebar__scrollwrap {
|
||||
width: calc(12.1rem);
|
||||
overflow-y: hidden;
|
||||
}
|
||||
.md-sidebar--secondary {
|
||||
right: ${theme.spacing(3)}px;
|
||||
@@ -234,7 +235,7 @@ export default ({ theme, sidebar }: RuleOptions) => `
|
||||
#toggle-sidebar {
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
||||
.md-content {
|
||||
margin: 0;
|
||||
width: 100%;
|
||||
|
||||
Reference in New Issue
Block a user