import image as datauri, some eslint fixes
This commit is contained in:
parent
f1110e82de
commit
47f51ced7f
@ -52,7 +52,7 @@ export const buildConfig = {
|
|||||||
minify: false,
|
minify: false,
|
||||||
loader: {
|
loader: {
|
||||||
'.svg': 'text',
|
'.svg': 'text',
|
||||||
'.png': 'file',
|
'.png': 'dataurl',
|
||||||
},
|
},
|
||||||
target: [
|
target: [
|
||||||
'es6'
|
'es6'
|
||||||
|
@ -137,7 +137,6 @@ export const WalletBox = styled.div<{ noPadding?: boolean }>`
|
|||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
display: flex;
|
display: flex;
|
||||||
background-color: #f7f7f7;
|
|
||||||
button {
|
button {
|
||||||
margin-right: 8px;
|
margin-right: 8px;
|
||||||
margin-left: 8px;
|
margin-left: 8px;
|
||||||
@ -375,7 +374,6 @@ export const CenteredDialog = styled.div`
|
|||||||
border-bottom-right-radius: 6px;
|
border-bottom-right-radius: 6px;
|
||||||
border-bottom-left-radius: 6px;
|
border-bottom-left-radius: 6px;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
background-color: #f5f5f5;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,6 @@ import { setupI18n } from "@gnu-taler/taler-util";
|
|||||||
import { styled } from "@linaria/react";
|
import { styled } from "@linaria/react";
|
||||||
import {
|
import {
|
||||||
ComponentChild,
|
ComponentChild,
|
||||||
ComponentProps,
|
|
||||||
Fragment,
|
Fragment,
|
||||||
FunctionComponent,
|
FunctionComponent,
|
||||||
h,
|
h,
|
||||||
@ -60,6 +59,7 @@ const SideBar = styled.div`
|
|||||||
height: calc(100vh - 20px);
|
height: calc(100vh - 20px);
|
||||||
overflow-y: visible;
|
overflow-y: visible;
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
|
scroll-behavior: smooth;
|
||||||
& > {
|
& > {
|
||||||
ol {
|
ol {
|
||||||
padding: 4px;
|
padding: 4px;
|
||||||
@ -86,9 +86,10 @@ const SideBar = styled.div`
|
|||||||
|
|
||||||
const Content = styled.div`
|
const Content = styled.div`
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
padding: 20px;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
function parseExampleImport(group: string, im: any) {
|
function parseExampleImport(group: string, im: any): ComponentItem {
|
||||||
const component = im.default.title;
|
const component = im.default.title;
|
||||||
return {
|
return {
|
||||||
name: component,
|
name: component,
|
||||||
@ -113,6 +114,11 @@ const allExamples = Object.entries({ popup, wallet, mui }).map(
|
|||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
interface ComponentItem {
|
||||||
|
name: string;
|
||||||
|
examples: ExampleItem[];
|
||||||
|
}
|
||||||
|
|
||||||
interface ExampleItem {
|
interface ExampleItem {
|
||||||
group: string;
|
group: string;
|
||||||
component: string;
|
component: string;
|
||||||
@ -127,7 +133,7 @@ function findByGroupComponentName(
|
|||||||
group: string,
|
group: string,
|
||||||
component: string,
|
component: string,
|
||||||
name: string,
|
name: string,
|
||||||
) {
|
): ExampleItem | undefined {
|
||||||
const gl = allExamples.filter((e) => e.title === group);
|
const gl = allExamples.filter((e) => e.title === group);
|
||||||
if (gl.length === 0) {
|
if (gl.length === 0) {
|
||||||
return undefined;
|
return undefined;
|
||||||
@ -163,7 +169,7 @@ function ExampleList({
|
|||||||
name: string;
|
name: string;
|
||||||
examples: ExampleItem[];
|
examples: ExampleItem[];
|
||||||
}[];
|
}[];
|
||||||
}) {
|
}): VNode {
|
||||||
const [open, setOpen] = useState(true);
|
const [open, setOpen] = useState(true);
|
||||||
return (
|
return (
|
||||||
<ol>
|
<ol>
|
||||||
@ -173,17 +179,15 @@ function ExampleList({
|
|||||||
<li>
|
<li>
|
||||||
<dl>
|
<dl>
|
||||||
<dt>{k.name}</dt>
|
<dt>{k.name}</dt>
|
||||||
{k.examples.map((r) => (
|
{k.examples.map((r) => {
|
||||||
<dd>
|
const e = encodeURIComponent;
|
||||||
<a
|
const eId = `${e(r.group)}-${e(r.component)}-${e(r.name)}`;
|
||||||
href={`#${encodeURIComponent(r.group)}-${encodeURIComponent(
|
return (
|
||||||
r.component,
|
<dd id={eId}>
|
||||||
)}-${encodeURIComponent(r.name)}`}
|
<a href={`#${eId}`}>{r.name}</a>
|
||||||
>
|
</dd>
|
||||||
{r.name}
|
);
|
||||||
</a>
|
})}
|
||||||
</dd>
|
|
||||||
))}
|
|
||||||
</dl>
|
</dl>
|
||||||
</li>
|
</li>
|
||||||
))}
|
))}
|
||||||
@ -219,7 +223,7 @@ function ErrorReport({
|
|||||||
}: {
|
}: {
|
||||||
children: ComponentChild;
|
children: ComponentChild;
|
||||||
selected: ExampleItem | undefined;
|
selected: ExampleItem | undefined;
|
||||||
}) {
|
}): VNode {
|
||||||
const [error] = useErrorBoundary();
|
const [error] = useErrorBoundary();
|
||||||
if (error) {
|
if (error) {
|
||||||
return (
|
return (
|
||||||
@ -261,13 +265,13 @@ function getSelectionFromLocationHash(): ExampleItem | undefined {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function Application() {
|
function Application(): VNode {
|
||||||
const initialSelection = getSelectionFromLocationHash();
|
const initialSelection = getSelectionFromLocationHash();
|
||||||
const [selected, updateSelected] = useState<ExampleItem | undefined>(
|
const [selected, updateSelected] = useState<ExampleItem | undefined>(
|
||||||
initialSelection,
|
initialSelection,
|
||||||
);
|
);
|
||||||
|
|
||||||
function updateSelectedFromHashChange({ newURL, oldURL }: any) {
|
function updateSelectedFromHashChange({ newURL, oldURL }: any): void {
|
||||||
const selected = getSelectionFromLocationHash();
|
const selected = getSelectionFromLocationHash();
|
||||||
updateSelected(selected);
|
updateSelected(selected);
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
* @author Sebastian Javier Marchano (sebasjm)
|
* @author Sebastian Javier Marchano (sebasjm)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Amounts, Balance, parsePaytoUri } from "@gnu-taler/taler-util";
|
import { Balance, parsePaytoUri } from "@gnu-taler/taler-util";
|
||||||
import { DepositFee } from "@gnu-taler/taler-wallet-core/src/operations/deposits";
|
import { DepositFee } from "@gnu-taler/taler-wallet-core/src/operations/deposits";
|
||||||
import { createExample } from "../test-utils.js";
|
import { createExample } from "../test-utils.js";
|
||||||
import { View as TestedComponent } from "./DepositPage.js";
|
import { View as TestedComponent } from "./DepositPage.js";
|
||||||
@ -46,6 +46,7 @@ export const WithEmptyAccountList = createExample(TestedComponent, {
|
|||||||
available: "USD:10",
|
available: "USD:10",
|
||||||
} as Balance,
|
} as Balance,
|
||||||
],
|
],
|
||||||
|
currency: "USD",
|
||||||
onCalculateFee: alwaysReturnFeeToOne,
|
onCalculateFee: alwaysReturnFeeToOne,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -56,5 +57,6 @@ export const WithSomeBankAccounts = createExample(TestedComponent, {
|
|||||||
available: "USD:10",
|
available: "USD:10",
|
||||||
} as Balance,
|
} as Balance,
|
||||||
],
|
],
|
||||||
|
currency: "USD",
|
||||||
onCalculateFee: alwaysReturnFeeToOne,
|
onCalculateFee: alwaysReturnFeeToOne,
|
||||||
});
|
});
|
||||||
|
@ -32,7 +32,6 @@ import {
|
|||||||
TransactionWithdrawal,
|
TransactionWithdrawal,
|
||||||
WithdrawalType,
|
WithdrawalType,
|
||||||
} from "@gnu-taler/taler-util";
|
} from "@gnu-taler/taler-util";
|
||||||
import { ComponentChildren, h } from "preact";
|
|
||||||
import { DevContextProviderForTesting } from "../context/devContext.js";
|
import { DevContextProviderForTesting } from "../context/devContext.js";
|
||||||
import {
|
import {
|
||||||
createExample,
|
createExample,
|
||||||
@ -239,6 +238,8 @@ export const PaymentPending = createExample(TestedComponent, {
|
|||||||
transaction: { ...exampleData.payment, pending: true },
|
transaction: { ...exampleData.payment, pending: true },
|
||||||
});
|
});
|
||||||
|
|
||||||
|
import beer from "../../static-dev/beer.png";
|
||||||
|
|
||||||
export const PaymentWithProducts = createExample(TestedComponent, {
|
export const PaymentWithProducts = createExample(TestedComponent, {
|
||||||
transaction: {
|
transaction: {
|
||||||
...exampleData.payment,
|
...exampleData.payment,
|
||||||
@ -263,11 +264,13 @@ export const PaymentWithProducts = createExample(TestedComponent, {
|
|||||||
description: "beer",
|
description: "beer",
|
||||||
unit: "pint",
|
unit: "pint",
|
||||||
quantity: 15,
|
quantity: 15,
|
||||||
|
image: beer,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
description: "beer",
|
description: "beer",
|
||||||
unit: "pint",
|
unit: "pint",
|
||||||
quantity: 15,
|
quantity: 15,
|
||||||
|
image: beer,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user