components#Title TypeScript Examples
The following examples show how to use
components#Title.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: title.spec.tsx From solo with MIT License | 6 votes |
describe("title component", () => {
it("matches snapshot", () => {
const { asFragment } = render(<Title>Test Title</Title>);
expect(asFragment()).toMatchSnapshot();
});
it("Includes title being passed as children", () => {
const { queryByText } = render(<Title>Title Argument</Title>);
expect(queryByText("Title Argument")).toBeInTheDocument();
});
});
Example #2
Source File: AdminPage.tsx From solo with MIT License | 6 votes |
AdminPage: React.FC = () => {
const {
//loadingStatus,
modifyWarehouseUser,
updateUserPermissons,
// pageCount,
users
} = useWarehouseUsers();
const tableColumns = useMemo(
() => createColumns(modifyWarehouseUser, updateUserPermissons),
[modifyWarehouseUser, updateUserPermissons]
);
return (
<div className="tablet:margin-x-8 overflow-x-auto">
<Title>User Administration</Title>
<Table<WarehouseUser> columns={tableColumns} data={users} />
</div>
);
}
Example #3
Source File: ConfirmationOfReceiptPage.tsx From solo with MIT License | 5 votes |
ConfirmationOfReceiptPage: React.FC = () => {
const [bulkReceivedBy, setBulkReceivedBy] = useState("");
const {
docs,
updateDocuments,
pageCount,
submitCOR,
submitBulkCOR,
bulkSubmitStatus,
resetBulkSubmitStatus
} = useCORDocuments();
const columns = useMemo(
() =>
createColumns({
onSubmitCOR: submitCOR
}),
[submitCOR]
);
const onSelectedRowsChange = useCallback(
({ toggleHideColumn, selectedFlatRows }: TableInstance<Document>) => {
// show individual row submit forms only when no rows are selected
resetBulkSubmitStatus();
toggleHideColumn("submitCOR", selectedFlatRows.length > 0);
},
[resetBulkSubmitStatus]
);
const renderPagination = (table: TableInstance<Document>) => (
<>{table.selectedFlatRows.length === 0 && <Paginator table={table} />}</>
);
const renderFilterControls = (table: TableInstance<Document>) => {
const { setGlobalFilter, selectedFlatRows } = table;
return selectedFlatRows.length > 0 ? (
<CORInputForm
value={bulkReceivedBy}
onReceivedByChange={setBulkReceivedBy}
onSubmitCOR={() =>
submitBulkCOR(
selectedFlatRows.map(({ original }) => original.sdn),
bulkReceivedBy
)
}
actionText={`Submit ${selectedFlatRows.length} Cors`}
className="margin-left-2 padding-y-2 flex-justify-center"
{...bulkSubmitStatus}
/>
) : (
<SelectFilterControls options={filterable} onSubmit={setGlobalFilter} />
);
};
return (
<div className="tablet:margin-x-8 overflow-x-auto">
<Title>Confirmation of Receipt</Title>
<Table<Document>
columns={columns}
data={docs}
onSelectedRowsChange={onSelectedRowsChange}
renderFilterControls={renderFilterControls}
renderPagination={renderPagination}
pageCount={pageCount}
fetchData={updateDocuments}
/>
</div>
);
}
Example #4
Source File: EnterReceiptPage.tsx From solo with MIT License | 5 votes |
EnterReceiptPage: React.FC = () => {
const {
docs,
addSdn,
submitAllLoadingStatus,
submitAll,
modifyDocument,
removeDocument
} = useEnterReceiptDocuments();
const columns = useMemo(() => createColumns(modifyDocument, removeDocument), [
modifyDocument,
removeDocument
]);
const [duplicateSdn, setDuplicateSdn] = useState(false);
const onAddSdn = (sdn: string) => {
setDuplicateSdn(false);
const isDuplicate = docs.some(doc => doc.sdn === sdn);
if (isDuplicate) {
setDuplicateSdn(true);
} else if (sdn !== "") {
addSdn(sdn);
}
};
return (
<div className="tablet:margin-x-8 overflow-x-auto">
<Title>Enter Receipt</Title>
<EnterReceiptStatusIndicator {...submitAllLoadingStatus} />
<Table<Document>
columns={columns}
data={docs}
manualPagination={false}
manualSortBy={false}
/>
<DuplicateSdnIndicator isDuplicate={duplicateSdn} />
<div className="grid-row flex-align-start flex-justify margin-bottom-1em">
<SdnInputForm
onSubmit={onAddSdn}
disabled={submitAllLoadingStatus.loading}
/>
<Button
onClick={submitAll}
className="margin-top-1"
disabled={submitAllLoadingStatus.loading || docs.length < 1}
>
Submit All
</Button>
</div>
</div>
);
}
Example #5
Source File: StatusPage.tsx From solo with MIT License | 5 votes |
StatusPage: React.FC = () => {
const { docs, updateDocuments, pageCount } = useDocumentSet();
const tableColumns = useMemo(createColumns, []);
const renderSubComponent = ({
original: { shipTo, holder, part, statuses }
}: Row<Document>) => (
<>
<DocumentStepper statuses={statuses} />
<DocumentDetails
shipper={holder}
receiver={shipTo}
part={part}
statuses={statuses}
/>
</>
);
const renderPagination = (table: TableInstance<Document>) => (
<Paginator table={table} />
);
const renderFilterControls = ({
setGlobalFilter
}: TableInstance<Document>) => (
<SelectFilterControls options={filterable} onSubmit={setGlobalFilter} />
);
return (
<div className="tablet:margin-x-8 overflow-x-auto">
<Title>Status</Title>
<Table<Document>
columns={tableColumns}
data={docs}
renderSubComponent={renderSubComponent}
renderPagination={renderPagination}
renderFilterControls={renderFilterControls}
fetchData={updateDocuments}
pageCount={pageCount}
/>
</div>
);
}