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 && ( {keypairs?.length && (
<select <select
name="change-key" name="change-key"
className="w-full px-8 py-2 border-black border"
value={keypair ? keypair.pub : 'none'} value={keypair ? keypair.pub : 'none'}
onChange={(e) => selectPublicKey(e.target.value)} onChange={(e) => selectPublicKey(e.target.value)}
> >
@ -40,7 +41,9 @@ export function Index() {
</select> </select>
) : null} ) : null}
<h2>Public keys</h2> <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> </div>
); );
} }

View File

@ -2,10 +2,24 @@ import React from 'react';
import { render } from '@testing-library/react'; import { render } from '@testing-library/react';
import Index from '../pages/index.page'; import Index from '../pages/index.page';
import { VegaWalletContext } from '@vegaprotocol/react-helpers';
describe('Index', () => { describe('Index', () => {
it('should render successfully', () => { 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(); expect(baseElement).toBeTruthy();
}); });
}); });

View File

@ -4,7 +4,8 @@ const theme = require('../../libs/tailwindcss-config/src/theme');
module.exports = { module.exports = {
content: [ 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), ...createGlobPatternsForDependencies(__dirname),
], ],
darkMode: 'class', darkMode: 'class',

View File

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

View File

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

View File

@ -22,7 +22,7 @@ export function RestConnectorForm({
} = useForm<FormFields>({ } = useForm<FormFields>({
// TODO: Remove default values // TODO: Remove default values
defaultValues: { defaultValues: {
wallet: 'test6', wallet: 'test',
passphrase: '123', passphrase: '123',
}, },
}); });
@ -48,6 +48,7 @@ export function RestConnectorForm({
<form onSubmit={handleSubmit(onSubmit)}> <form onSubmit={handleSubmit(onSubmit)}>
<div style={{ marginBottom: 10 }}> <div style={{ marginBottom: 10 }}>
<input <input
className="w-full px-8 py-2 border-black border"
{...register('wallet', { required: 'Required' })} {...register('wallet', { required: 'Required' })}
type="text" type="text"
placeholder="Wallet" placeholder="Wallet"
@ -56,6 +57,7 @@ export function RestConnectorForm({
</div> </div>
<div style={{ marginBottom: 10 }}> <div style={{ marginBottom: 10 }}>
<input <input
className="w-full px-8 py-2 border-black border"
{...register('passphrase', { required: 'Required' })} {...register('passphrase', { required: 'Required' })}
type="text" type="text"
placeholder="Passphrase" 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", "tsConfig": "libs/storage/tsconfig.lib.json",
"project": "libs/storage/package.json", "project": "libs/storage/package.json",
"entryFile": "libs/storage/src/index.ts", "entryFile": "libs/storage/src/index.ts",
"external": ["react/jsx-runtime"],
"rollupConfig": "@nrwl/react/plugins/bundle-rollup", "rollupConfig": "@nrwl/react/plugins/bundle-rollup",
"compiler": "babel", "compiler": "babel",
"assets": [ "assets": [

View File

@ -12,7 +12,7 @@ export function Dialog({ children, open, setOpen }: DialogProps) {
<DialogPrimitives.Root open={open} onOpenChange={(x) => setOpen(x)}> <DialogPrimitives.Root open={open} onOpenChange={(x) => setOpen(x)}>
<DialogPrimitives.Portal> <DialogPrimitives.Portal>
<DialogPrimitives.Overlay className="fixed inset-0 bg-black opacity-20" /> <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} {children}
</DialogPrimitives.Content> </DialogPrimitives.Content>
</DialogPrimitives.Portal> </DialogPrimitives.Portal>

View File

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

View File

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