Skip to content

Commit

Permalink
Fix overlaping placeholder
Browse files Browse the repository at this point in the history
  • Loading branch information
camilovegag committed Feb 9, 2024
1 parent 71dd852 commit c68cf2d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion packages/berlin/src/components/select/Select.styled.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ import React from 'react';
import styled from 'styled-components';
import { FlexColumn } from '../containers/FlexColum.styled';

export const SelectContainer = styled.div`
export const SelectContainer = styled.div<{ $minWidth?: string }>`
position: relative;
width: 100%;
min-width: ${(props) => props.$minWidth && props.$minWidth};
`;

export const SearchInput = styled.input<{ $theme?: 'light' | 'dark' }>`
Expand Down
6 changes: 4 additions & 2 deletions packages/berlin/src/components/select/Select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ type SelectProps = {
onBlur?: () => void;
onOptionCreate?: (option: string) => void;
value?: string;
$minWidth?: string;
};

function Select({
Expand All @@ -33,12 +34,13 @@ function Select({
onOptionCreate,
value,
onBlur,
$minWidth,
}: SelectProps) {
const theme = useAppStore((state) => state.theme);
const [isDropdownOpen, setIsDropdownOpen] = useState(false);
const [searchTerm, setSearchTerm] = useState(options.find((o) => o.name === value)?.name ?? '');
const [selectedOption, setSelectedOption] = useState<string | undefined>(
options.find((o) => o.id === value)?.name
options.find((o) => o.id === value)?.name,
);
const [creatableOption, setCreatableOption] = useState<string>('');

Expand Down Expand Up @@ -82,7 +84,7 @@ function Select({
};

return (
<SelectContainer>
<SelectContainer $minWidth={$minWidth}>
{label && (
<LabelContainer>
<Label $required={required}>{label}</Label>{' '}
Expand Down
3 changes: 2 additions & 1 deletion packages/berlin/src/pages/Account.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -297,10 +297,11 @@ function AccountForm({
onBlur={field.onBlur}
value={field.value}
onOptionCreate={field.onChange}
placeholder="Select or create your credential"
placeholder="Select or create credential"
errors={[
errors.userAttributes?.credentialsGroup?.[i]?.credential?.message ?? '',
]}
$minWidth="208px"
/>
)}
/>
Expand Down

0 comments on commit c68cf2d

Please sign in to comment.