Skip to content

Commit

Permalink
Experiment with global css styles
Browse files Browse the repository at this point in the history
  • Loading branch information
peterMuriuki committed Apr 26, 2024
1 parent e472a7a commit 18b3cdf
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export const UserList = (props: OrganizationListProps) => {
const columns = getTableColumns(keycloakBaseURL, fhirBaseURL, extraData, t, userRole, history);

const searchFormProps = {
wrapperClassName: 'long-search-bar',
defaultValue: getQueryParams(location)[searchQuery],
onChangeHandler: function onChangeHandler(event: React.ChangeEvent<HTMLInputElement>) {
const searchText = event.target.value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ const UserList = (props: UserListTypes): JSX.Element => {
<Col className="main-content" span={openDetails ? 19 : 24}>
<div className="main-content__header">
<SearchForm
wrapperClassName="long-search-bar"
defaultValue={getQueryParams(props.location)[SEARCH_QUERY_PARAM]}
onChange={createChangeHandler(SEARCH_QUERY_PARAM, props)}
size={'middle'}
Expand Down
4 changes: 4 additions & 0 deletions packages/react-utils/src/components/CommonStyles/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,7 @@
.flex-grow-1 {
flex-grow: 1;
}

.long-search-bar {
width: 55%;
}
5 changes: 3 additions & 2 deletions packages/react-utils/src/components/Search/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { useTranslation } from '../../mls';
*/
export interface SearchFormProps extends InputProps {
onChangeHandler: OnChangeType;
wrapperClassName?: string;
}

const defaultPrefix = <SearchOutlined style={{ fontSize: '16px', fontWeight: 'bold' }} />;
Expand All @@ -31,7 +32,7 @@ export const defaultSearchProps: SearchFormProps = {
* @param props - the component's props
*/
const SearchForm = (props: SearchFormProps) => {
const { onChangeHandler, ...passedOnProps } = props;
const { onChangeHandler, wrapperClassName, ...passedOnProps } = props;
// HACK to preserve defaultProps back compatibility
const { t } = useTranslation();
passedOnProps['placeholder'] = props.placeholder ?? t('Search');
Expand All @@ -51,7 +52,7 @@ const SearchForm = (props: SearchFormProps) => {
};

return (
<div className="search-input-wrapper">
<div className={`search-input-wrapper ${wrapperClassName ? wrapperClassName : ''}`}>
<Input onChange={debouncedOnChangeHandler} {...passedOnProps}></Input>
</div>
);
Expand Down
1 change: 1 addition & 0 deletions packages/react-utils/src/hooks/useSimpleTabularView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ export function useSimpleTabularView<T extends Resource>(
const { data, ...restQueryValues } = useQuery(rQuery);

const searchFormProps = {
wrapperClassName: 'long-search-bar',
defaultValue: getQueryParams(location)[searchQuery],
onChangeHandler: function onChangeHandler(event: ChangeEvent<HTMLInputElement>) {
const nextUrl = getNextUrlOnSearch(event, location, match);
Expand Down

0 comments on commit 18b3cdf

Please sign in to comment.