Skip to content
This repository has been archived by the owner on Dec 18, 2024. It is now read-only.

fix: separately import solid functions in storybook examples #997

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions stories/components/link.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

import type { ReactElement } from "react";
import React from "react";
import SolidFns from "@inrupt/solid-client";
import { addUrl, createThing, setThing, createSolidDataset } from "@inrupt/solid-client";
import { Link } from "../../src/components/link";

export default {
Expand All @@ -48,8 +48,8 @@ export default {

export function WithChildren({ property }: { property: string }): ReactElement {
const exampleUrl = "http://test.url";
const exampleThing = SolidFns.addUrl(
SolidFns.createThing(),
const exampleThing = addUrl(
createThing(),
property,
exampleUrl,
);
Expand All @@ -74,8 +74,8 @@ export function WithoutChildren({
property: string;
}): ReactElement {
const exampleUrl = "http://test.url";
const exampleThing = SolidFns.addUrl(
SolidFns.createThing(),
const exampleThing = addUrl(
createThing(),
property,
exampleUrl,
);
Expand All @@ -92,14 +92,14 @@ WithoutChildren.args = {

export function Editable({ property }: { property: string }): ReactElement {
const exampleUrl = "http://test.url";
const exampleThing = SolidFns.addUrl(
SolidFns.createThing(),
const exampleThing = addUrl(
createThing(),
property,
exampleUrl,
);

const exampleDataset = SolidFns.setThing(
SolidFns.createSolidDataset(),
const exampleDataset = setThing(
createSolidDataset(),
exampleThing,
);

Expand All @@ -124,8 +124,8 @@ Editable.args = {
export function ErrorComponent(): ReactElement {
const exampleUrl = "http://test.url";
const property = "http://xmlns.com/foaf/0.1/homepage";
const exampleThing = SolidFns.addUrl(
SolidFns.createThing(),
const exampleThing = addUrl(
createThing(),
property,
exampleUrl,
);
Expand Down
144 changes: 72 additions & 72 deletions stories/components/table.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

import type { ReactElement } from "react";
import React, { useContext } from "react";
import SolidFns from "@inrupt/solid-client";
import { addDatetime, addStringNoLocale, createSolidDataset, createThing, getThing, getUrl, setThing, SolidDataset } from "@inrupt/solid-client";
import DatasetContext, {
DatasetProvider,
} from "../../src/context/datasetContext";
Expand Down Expand Up @@ -64,27 +64,27 @@ export function BasicExample(): ReactElement {
const namePredicate = `http://xmlns.com/foaf/0.1/name`;
const datePredicate = `http://schema.org/datePublished`;

const thing1A = SolidFns.addStringNoLocale(
SolidFns.createThing(),
const thing1A = addStringNoLocale(
createThing(),
namePredicate,
`example name 1`,
);
const thing1 = SolidFns.addDatetime(thing1A, datePredicate, new Date());
const thing1 = addDatetime(thing1A, datePredicate, new Date());

const thing2A = SolidFns.addStringNoLocale(
SolidFns.createThing(),
const thing2A = addStringNoLocale(
createThing(),
namePredicate,
`example name 2`,
);
const thing2 = SolidFns.addDatetime(
const thing2 = addDatetime(
thing2A,
datePredicate,
new Date("1999-01-02"),
);

const emptyDataset = SolidFns.createSolidDataset();
const datasetWithThing1 = SolidFns.setThing(emptyDataset, thing1);
const dataset = SolidFns.setThing(datasetWithThing1, thing2);
const emptyDataset = createSolidDataset();
const datasetWithThing1 = setThing(emptyDataset, thing1);
const dataset = setThing(datasetWithThing1, thing2);

return (
<Table
Expand All @@ -108,41 +108,41 @@ export function MultipleValues(): ReactElement {
const namePredicate = `http://xmlns.com/foaf/0.1/name`;
const nickPredicate = `http://xmlns.com/foaf/0.1/nick`;

const thing1A = SolidFns.addStringNoLocale(
SolidFns.createThing(),
const thing1A = addStringNoLocale(
createThing(),
namePredicate,
`example name 1`,
);
const thing1B = SolidFns.addStringNoLocale(
const thing1B = addStringNoLocale(
thing1A,
nickPredicate,
`Nickname`,
);
const thing1C = SolidFns.addStringNoLocale(
const thing1C = addStringNoLocale(
thing1B,
nickPredicate,
`Alt Nickname`,
);
const thing1 = SolidFns.addStringNoLocale(
const thing1 = addStringNoLocale(
thing1C,
nickPredicate,
`Final Nickname`,
);

const thing2A = SolidFns.addStringNoLocale(
SolidFns.createThing(),
const thing2A = addStringNoLocale(
createThing(),
namePredicate,
`example name 2`,
);
const thing2 = SolidFns.addStringNoLocale(
const thing2 = addStringNoLocale(
thing2A,
nickPredicate,
`example nickname 2`,
);

const emptyDataset = SolidFns.createSolidDataset();
const datasetWithThing1 = SolidFns.setThing(emptyDataset, thing1);
const dataset = SolidFns.setThing(datasetWithThing1, thing2);
const emptyDataset = createSolidDataset();
const datasetWithThing1 = setThing(emptyDataset, thing1);
const dataset = setThing(datasetWithThing1, thing2);

return (
<Table
Expand Down Expand Up @@ -172,27 +172,27 @@ export function CustomBodyComponent(): ReactElement {
const namePredicate = `http://xmlns.com/foaf/0.1/name`;
const datePredicate = `http://schema.org/datePublished`;

const thing1A = SolidFns.addStringNoLocale(
SolidFns.createThing(),
const thing1A = addStringNoLocale(
createThing(),
namePredicate,
`example name 1`,
);
const thing1 = SolidFns.addDatetime(thing1A, datePredicate, new Date());
const thing1 = addDatetime(thing1A, datePredicate, new Date());

const thing2A = SolidFns.addStringNoLocale(
SolidFns.createThing(),
const thing2A = addStringNoLocale(
createThing(),
namePredicate,
`example name 2`,
);
const thing2 = SolidFns.addDatetime(
const thing2 = addDatetime(
thing2A,
datePredicate,
new Date("1999-01-02"),
);

const emptyDataset = SolidFns.createSolidDataset();
const datasetWithThing1 = SolidFns.setThing(emptyDataset, thing1);
const dataset = SolidFns.setThing(datasetWithThing1, thing2);
const emptyDataset = createSolidDataset();
const datasetWithThing1 = setThing(emptyDataset, thing1);
const dataset = setThing(datasetWithThing1, thing2);

type bodyProps = {
value?: string;
Expand Down Expand Up @@ -244,16 +244,16 @@ export function NestedDataExample(): ReactElement {
}: {
numberThingIris: [string];
numberType: string;
dataset: SolidFns.SolidDataset;
dataset: SolidDataset;
}) {
let phoneNumber = "";
numberThingIris.some((numberThingIri) => {
const numberThing = SolidFns.getThing(dataset, numberThingIri);
const numberThing = getThing(dataset, numberThingIri);
if (
numberThing &&
SolidFns.getUrl(numberThing, typeProperty) === numberType
getUrl(numberThing, typeProperty) === numberType
) {
phoneNumber = SolidFns.getUrl(numberThing, valueProperty) ?? "";
phoneNumber = getUrl(numberThing, valueProperty) ?? "";
return true;
}
return false;
Expand All @@ -267,11 +267,11 @@ export function NestedDataExample(): ReactElement {
if (!solidDataset) {
return null;
}
const personThing = SolidFns.getThing(
const personThing = getThing(
solidDataset,
`${host}/example.ttl#me`,
);
const alterEgoThing = SolidFns.getThing(
const alterEgoThing = getThing(
solidDataset,
`${host}/example.ttl#alterEgo`,
);
Expand Down Expand Up @@ -338,27 +338,27 @@ export function SortableColumns(): ReactElement {
const namePredicate = `http://xmlns.com/foaf/0.1/name`;
const datePredicate = `http://schema.org/datePublished`;

const thing1A = SolidFns.addStringNoLocale(
SolidFns.createThing(),
const thing1A = addStringNoLocale(
createThing(),
namePredicate,
`example name 1`,
);
const thing1 = SolidFns.addDatetime(thing1A, datePredicate, new Date());
const thing1 = addDatetime(thing1A, datePredicate, new Date());

const thing2A = SolidFns.addStringNoLocale(
SolidFns.createThing(),
const thing2A = addStringNoLocale(
createThing(),
namePredicate,
`example name 2`,
);
const thing2 = SolidFns.addDatetime(
const thing2 = addDatetime(
thing2A,
datePredicate,
new Date("1999-01-02"),
);

const emptyDataset = SolidFns.createSolidDataset();
const datasetWithThing1 = SolidFns.setThing(emptyDataset, thing1);
const dataset = SolidFns.setThing(datasetWithThing1, thing2);
const emptyDataset = createSolidDataset();
const datasetWithThing1 = setThing(emptyDataset, thing1);
const dataset = setThing(datasetWithThing1, thing2);

return (
<Table
Expand Down Expand Up @@ -394,27 +394,27 @@ export function FilterOnFirstColumn({
const namePredicate = `http://xmlns.com/foaf/0.1/name`;
const datePredicate = `http://schema.org/datePublished`;

const thing1A = SolidFns.addStringNoLocale(
SolidFns.createThing(),
const thing1A = addStringNoLocale(
createThing(),
namePredicate,
`example name 1`,
);
const thing1 = SolidFns.addDatetime(thing1A, datePredicate, new Date());
const thing1 = addDatetime(thing1A, datePredicate, new Date());

const thing2A = SolidFns.addStringNoLocale(
SolidFns.createThing(),
const thing2A = addStringNoLocale(
createThing(),
namePredicate,
`example name 2`,
);
const thing2 = SolidFns.addDatetime(
const thing2 = addDatetime(
thing2A,
datePredicate,
new Date("1999-01-02"),
);

const emptyDataset = SolidFns.createSolidDataset();
const datasetWithThing1 = SolidFns.setThing(emptyDataset, thing1);
const dataset = SolidFns.setThing(datasetWithThing1, thing2);
const emptyDataset = createSolidDataset();
const datasetWithThing1 = setThing(emptyDataset, thing1);
const dataset = setThing(datasetWithThing1, thing2);

return (
<Table
Expand Down Expand Up @@ -449,27 +449,27 @@ export function SortingFunctionOnFirstColumn(): ReactElement {
const namePredicate = `http://xmlns.com/foaf/0.1/name`;
const datePredicate = `http://schema.org/datePublished`;

const thing1A = SolidFns.addStringNoLocale(
SolidFns.createThing(),
const thing1A = addStringNoLocale(
createThing(),
namePredicate,
"Another Name",
);
const thing1 = SolidFns.addDatetime(thing1A, datePredicate, new Date());
const thing1 = addDatetime(thing1A, datePredicate, new Date());

const thing2A = SolidFns.addStringNoLocale(
SolidFns.createThing(),
const thing2A = addStringNoLocale(
createThing(),
namePredicate,
"Name A",
);
const thing2 = SolidFns.addDatetime(
const thing2 = addDatetime(
thing2A,
datePredicate,
new Date("1999-01-02"),
);

const emptyDataset = SolidFns.createSolidDataset();
const datasetWithThing1 = SolidFns.setThing(emptyDataset, thing1);
const dataset = SolidFns.setThing(datasetWithThing1, thing2);
const emptyDataset = createSolidDataset();
const datasetWithThing1 = setThing(emptyDataset, thing1);
const dataset = setThing(datasetWithThing1, thing2);

const sortFunction = (a: string, b: string) => {
const valueA = a.split(/\s+/)[1];
Expand Down Expand Up @@ -504,27 +504,27 @@ export function NoDataComponent(): ReactElement {
const namePredicate = `http://xmlns.com/foaf/0.1/name`;
const datePredicate = `http://schema.org/datePublished`;

const thing1A = SolidFns.addStringNoLocale(
SolidFns.createThing(),
const thing1A = addStringNoLocale(
createThing(),
namePredicate,
`example name 1`,
);
const thing1 = SolidFns.addDatetime(thing1A, datePredicate, new Date());
const thing1 = addDatetime(thing1A, datePredicate, new Date());

const thing2A = SolidFns.addStringNoLocale(
SolidFns.createThing(),
const thing2A = addStringNoLocale(
createThing(),
namePredicate,
`example name 2`,
);
const thing2 = SolidFns.addDatetime(
const thing2 = addDatetime(
thing2A,
datePredicate,
new Date("1999-01-02"),
);

const emptyDataset = SolidFns.createSolidDataset();
const datasetWithThing1 = SolidFns.setThing(emptyDataset, thing1);
const dataset = SolidFns.setThing(datasetWithThing1, thing2);
const emptyDataset = createSolidDataset();
const datasetWithThing1 = setThing(emptyDataset, thing1);
const dataset = setThing(datasetWithThing1, thing2);

return (
<Table
Expand Down
Loading