tidy styles and tailwind config

This commit is contained in:
Matthew Russell 2022-02-28 14:29:05 -08:00
parent cb465ae37b
commit 0b3bf269b6
12 changed files with 41 additions and 16 deletions

View File

@ -26,6 +26,7 @@ export function Index() {
{keypairs?.length && (
<select
name="change-key"
className="w-full px-8 py-2 border-black border"
value={keypair ? keypair.pub : 'none'}
onChange={(e) => selectPublicKey(e.target.value)}
>
@ -40,7 +41,9 @@ export function Index() {
</select>
) : null}
<h2>Public keys</h2>
<pre>{JSON.stringify(keypairs, null, 2)}</pre>
<pre className="p-12 text-sm bg-neutral-100">
{JSON.stringify(keypairs, null, 2)}
</pre>
</div>
);
}

View File

@ -2,10 +2,24 @@ import React from 'react';
import { render } from '@testing-library/react';
import Index from '../pages/index.page';
import { VegaWalletContext } from '@vegaprotocol/react-helpers';
describe('Index', () => {
it('should render successfully', () => {
const { baseElement } = render(<Index />);
const { baseElement } = render(
<VegaWalletContext.Provider
value={{
keypair: null,
keypairs: null,
connect: jest.fn(),
disconnect: jest.fn(),
selectPublicKey: jest.fn(),
connector: null,
}}
>
<Index />
</VegaWalletContext.Provider>
);
expect(baseElement).toBeTruthy();
});
});

View File

@ -4,7 +4,8 @@ const theme = require('../../libs/tailwindcss-config/src/theme');
module.exports = {
content: [
join(__dirname, '{pages,components}/**/*.{js,ts,jsx,tsx}'),
join(__dirname, 'pages/**/*.{js,ts,jsx,tsx}'),
join(__dirname, 'components/**/*.{js,ts,jsx,tsx}'),
...createGlobPatternsForDependencies(__dirname),
],
darkMode: 'class',

View File

@ -53,14 +53,7 @@ export function VegaConnectDialog({
}}
/>
) : (
<div
style={{
display: 'flex',
flexDirection: 'column',
justifyContent: 'center',
gap: 10,
}}
>
<div className="flex flex-col justify-center gap-4 items-start">
{Object.entries(connectors).map(([key, connector]) => (
<button key={key} onClick={() => setSelectedConnector(connector)}>
{key} provider

View File

@ -9,6 +9,7 @@ import { LocalStorage } from '@vegaprotocol/storage';
export interface VegaConnector {
/** Connect to wallet and return keys */
connect(): Promise<VegaKey[] | null>;
/** Disconnect from wallet */
disconnect(): Promise<void>;
}

View File

@ -22,7 +22,7 @@ export function RestConnectorForm({
} = useForm<FormFields>({
// TODO: Remove default values
defaultValues: {
wallet: 'test6',
wallet: 'test',
passphrase: '123',
},
});
@ -48,6 +48,7 @@ export function RestConnectorForm({
<form onSubmit={handleSubmit(onSubmit)}>
<div style={{ marginBottom: 10 }}>
<input
className="w-full px-8 py-2 border-black border"
{...register('wallet', { required: 'Required' })}
type="text"
placeholder="Wallet"
@ -56,6 +57,7 @@ export function RestConnectorForm({
</div>
<div style={{ marginBottom: 10 }}>
<input
className="w-full px-8 py-2 border-black border"
{...register('passphrase', { required: 'Required' })}
type="text"
placeholder="Passphrase"

1
libs/storage/README.md Normal file
View File

@ -0,0 +1 @@
# Local storage helpers

View File

@ -0,0 +1,9 @@
module.exports = {
displayName: 'storage',
preset: '../../jest.preset.js',
transform: {
'^.+\\.[tj]sx?$': 'babel-jest',
},
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
coverageDirectory: '../../coverage/libs/storage',
};

View File

@ -12,7 +12,6 @@
"tsConfig": "libs/storage/tsconfig.lib.json",
"project": "libs/storage/package.json",
"entryFile": "libs/storage/src/index.ts",
"external": ["react/jsx-runtime"],
"rollupConfig": "@nrwl/react/plugins/bundle-rollup",
"compiler": "babel",
"assets": [

View File

@ -12,7 +12,7 @@ export function Dialog({ children, open, setOpen }: DialogProps) {
<DialogPrimitives.Root open={open} onOpenChange={(x) => setOpen(x)}>
<DialogPrimitives.Portal>
<DialogPrimitives.Overlay className="fixed inset-0 bg-black opacity-20" />
<DialogPrimitives.Content className="fixed w-[300px] w-px bg-white top-40 p-12 left-[calc(50%-150px)]">
<DialogPrimitives.Content className="fixed w-[300px] bg-white top-40 p-12 left-[calc(50%-150px)]">
{children}
</DialogPrimitives.Content>
</DialogPrimitives.Portal>

View File

@ -1,3 +1,3 @@
@tailwind components;
@tailwind base;
@tailwind components;
@tailwind utilities;

View File

@ -9,6 +9,8 @@ module.exports = {
...createGlobPatternsForDependencies(__dirname),
],
darkMode: 'class',
theme,
theme: {
extend: theme,
},
plugins: [],
};