Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(app) dqa software keyboard round3 #13493

Merged
merged 7 commits into from
Sep 12, 2023
Merged
Show file tree
Hide file tree
Changes from 5 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
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ import {
POSITION_ABSOLUTE,
SPACING,
} from '@opentrons/components'
import { InputField } from '../InputField'
import { CustomKeyboard } from './'
koji marked this conversation as resolved.
Show resolved Hide resolved
import { InputField } from '../../InputField'
import { CustomKeyboard } from '.'
import '../../../styles.global.css'

import type { Story, Meta } from '@storybook/react'

export default {
title: 'Odd/Atoms/SoftwareKeyboard/CustomKeyboard',
title: 'ODD/Atoms/SoftwareKeyboard/CustomKeyboard',
component: CustomKeyboard,
} as Meta

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from 'react'
import { fireEvent } from '@testing-library/react'
import { renderHook } from '@testing-library/react-hooks'
import { renderWithProviders } from '@opentrons/components'
import { CustomKeyboard } from '..'
import { CustomKeyboard } from '../'
koji marked this conversation as resolved.
Show resolved Hide resolved

const render = (props: React.ComponentProps<typeof CustomKeyboard>) => {
return renderWithProviders(<CustomKeyboard {...props} />)[0]
Expand Down Expand Up @@ -84,7 +84,7 @@ describe('CustomKeyboard', () => {
'J',
'K',
'L',
'SHIFT',
'abc',
'Z',
'X',
'C',
Expand Down
32 changes: 32 additions & 0 deletions app/src/atoms/SoftwareKeyboard/CustomKeyboard/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/* stylelint-disable */

.simple-keyboard.oddTheme1.hg-theme-default {
width: 100%;
height: 100%;
background-color: #d0d0d0;
font-family: 'Public Sans', sans-serif;
padding: 8px;
font-size: 28px;
}

.simple-keyboard.oddTheme1
.hg-row:not(:last-child)
.hg-button:not(:last-child) {
margin-right: 8px;
}

.simple-keyboard.simple-keyboard.oddTheme1 .hg-button {
height: 48px;
}

.simple-keyboard .hg-button:active {
color: #16212d;
background-color: #e3e3e3;
}

/* Numeric keyboard in custom keyboard */
.hg-layout-numbers button.hg-button.hg-button-backspace,
.hg-layout-numbers button.hg-button.hg-button-abc,
.hg-layout-numbers button.hg-button.hg-standardBtn {
flex: 1;
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react'
import Keyboard from 'react-simple-keyboard'
import { customDisplay } from './constants'
import { customDisplay } from '../constants'

interface CustomKeyboardProps {
onChange: (input: string) => void
Expand All @@ -17,7 +17,7 @@ const customLayout = {
shift: [
'Q W E R T Y U I O P',
'A S D F G H J K L',
'{shift} Z X C V B N M {backspace}',
'{abc} Z X C V B N M {backspace}',
'{numbers}',
],
numbers: ['1 2 3', '4 5 6', '7 8 9', '{abc} 0 {backspace}'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import {
POSITION_ABSOLUTE,
SPACING,
} from '@opentrons/components'
import { InputField } from '../InputField'
import { NormalKeyboard } from './'
import '../../styles.global.css'
import { InputField } from '../../InputField'
import { NormalKeyboard } from '.'
import '../../../styles.global.css'

import type { Story, Meta } from '@storybook/react'

export default {
title: 'Odd/Atoms/SoftwareKeyboard/NormalKeyboard',
title: 'ODD/Atoms/SoftwareKeyboard/NormalKeyboard',
component: NormalKeyboard,
} as Meta

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ describe('SoftwareKeyboard', () => {
'J',
'K',
'L',
'SHIFT',
'abc',
'Z',
'X',
'C',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,13 @@
.hg-row:not(:last-child)
.hg-button:not(:last-child) {
margin-right: 8px;
margin-bottom: 2px;
}

.simple-keyboard.simple-keyboard.oddTheme1 .hg-button {
height: 48px;
}

.simple-keyboard .hg-button:active {
color: white;
color: #16212d;
background-color: #e3e3e3;
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react'
import Keyboard from 'react-simple-keyboard'
import { customDisplay } from './constants'
import { customDisplay } from '../constants'

interface NormalKeyboardProps {
onChange: (input: string) => void
Expand All @@ -20,7 +20,7 @@ const customLayout = {
shift: [
'Q W E R T Y U I O P',
'{numbers} A S D F G H J K L',
'{shift} Z X C V B N M {backspace}',
'{abc} Z X C V B N M {backspace}',
'{space}',
],
symbols: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ import {
POSITION_ABSOLUTE,
SPACING,
} from '@opentrons/components'
import { InputField } from '../InputField'
import { InputField } from '../../InputField'
import { Numpad } from './'
import '../../../styles.global.css'

import type { Story, Meta } from '@storybook/react'

export default {
title: 'Odd/Atoms/SoftwareKeyboard/Numpad',
title: 'ODD/Atoms/SoftwareKeyboard/Numpad',
component: Numpad,
} as Meta

Expand Down
7 changes: 7 additions & 0 deletions app/src/atoms/SoftwareKeyboard/Numpad/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/* stylelint-disable */

.numpad button.hg-button.hg-button-backspace,
.numpad button.hg-button.hg-button-abc,
.numpad button.hg-button.hg-standardBtn {
flex: 1;
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export function Numpad({ onChange, keyboardRef }: NumpadProps): JSX.Element {
*/
<Keyboard
keyboardRef={r => (keyboardRef.current = r)}
theme={'hg-theme-default oddTheme1'}
theme={'hg-theme-default oddTheme1 numpad'}
onChange={onChange}
layoutName="default"
display={customDisplay}
Expand Down
2 changes: 1 addition & 1 deletion app/src/atoms/SoftwareKeyboard/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export { CustomKeyboard } from './CustomKeyboard'
export { NormalKeyboard } from './NormalKeyboard'
export { Numpad } from './Numpad'
export { CustomKeyboard } from './CustomKeyboard'
4 changes: 3 additions & 1 deletion app/src/styles.global.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@
*/

@import '../../node_modules/react-simple-keyboard/build/css/index.css';
@import './atoms/SoftwareKeyboard/index.css';
@import './atoms/SoftwareKeyboard/CustomKeyboard/index.css';
@import './atoms/SoftwareKeyboard/NormalKeyboard/index.css';
@import './atoms/SoftwareKeyboard/Numpad/index.css';
Loading