Commit be1ef124 authored by tom's avatar tom

fix clear button placement

parent e04c3b6c
import { LightMode } from '@chakra-ui/react';
import { test, expect } from '@playwright/experimental-ct-react';
import React from 'react';
import TestApp from 'playwright/TestApp';
import SearchBarInput from './SearchBarInput';
const props = {
onChange: () => {},
onSubmit: () => {},
onClear: () => {},
value: 'duck duck',
};
test('input on regular page +@mobile +@dark-mode', async({ mount, page }) => {
await mount(
<TestApp>
<SearchBarInput { ...props }/>
</TestApp>,
);
const input = page.getByPlaceholder(/search by/i);
await expect(input).toHaveScreenshot();
});
test('input on home page +@mobile +@dark-mode', async({ mount, page }) => {
await mount(
<TestApp>
<LightMode>
<SearchBarInput { ...props } isHomepage/>
</LightMode>
</TestApp>,
);
const input = page.getByPlaceholder(/search by/i);
await expect(input).toHaveScreenshot();
});
...@@ -107,7 +107,7 @@ const SearchBarInput = ({ onChange, onSubmit, isHomepage, onFocus, onBlur, onHid ...@@ -107,7 +107,7 @@ const SearchBarInput = ({ onChange, onSubmit, isHomepage, onFocus, onBlur, onHid
value={ value } value={ value }
/> />
{ value && ( { value && (
<InputRightElement top={{ base: 2, lg: '18px' }} right={ 2 }> <InputRightElement top={{ base: isHomepage ? '18px' : 2, lg: '18px' }} right={ 2 }>
<ClearButton onClick={ onClear }/> <ClearButton onClick={ onClear }/>
</InputRightElement> </InputRightElement>
) } ) }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment