diff --git a/src/pages/AccountSettings/tabs/Admin/DetailsSection/DetailsSection.jsx b/src/pages/AccountSettings/tabs/Admin/DetailsSection/DetailsSection.jsx index e627cbb99b..9519d0023f 100644 --- a/src/pages/AccountSettings/tabs/Admin/DetailsSection/DetailsSection.jsx +++ b/src/pages/AccountSettings/tabs/Admin/DetailsSection/DetailsSection.jsx @@ -56,7 +56,7 @@ function DetailsSection({ email, name }) { } return ( -
+
= ({ } return ( - - - - - - Branch Context - + + } + /> { return ( - - - Bundle - + + { const [filteredBundles, setFilteredBundles] = useState>([]) return ( - - - Bundle - + + { }, []) return ( - + }> diff --git a/src/pages/RepoPage/CommitsTab/CommitsTab.jsx b/src/pages/RepoPage/CommitsTab/CommitsTab.jsx index 0ff1da1f42..075bb59437 100644 --- a/src/pages/RepoPage/CommitsTab/CommitsTab.jsx +++ b/src/pages/RepoPage/CommitsTab/CommitsTab.jsx @@ -12,6 +12,7 @@ import { useBranchHasCommits } from 'services/branches' import { useLocationParams } from 'services/navigation' import { useRepoOverview, useRepoSettingsTeam } from 'services/repo' import { TierNames, useTier } from 'services/tier' +import FormLabel from 'ui/FormLabel/FormLabel' import Icon from 'ui/Icon' import MultiSelect from 'ui/MultiSelect' import SearchField from 'ui/SearchField' @@ -158,12 +159,10 @@ function CommitsTab() { - - - - - Branch Context - + } + /> - CI status + = ({ return ( - - - - - Branch Context - + } + /> { )} - - - - - Branch Context - + } + /> - - - Branch Context - + } + /> { + it('should render label if label is provided, and icon should not render', () => { + render() + expect(screen.getByText('Form label placeholder')).toBeInTheDocument() + expect(screen.queryByTestId('form-label-icon')).not.toBeInTheDocument() + }) + it('should render label and icon if provided', () => { + render(ICON} />) + expect(screen.getByText('Form label placeholder')).toBeInTheDocument() + expect(screen.getByTestId('form-label-icon')).toBeInTheDocument() + }) +}) diff --git a/src/ui/FormLabel/FormLabel.tsx b/src/ui/FormLabel/FormLabel.tsx new file mode 100644 index 0000000000..8987c43c9d --- /dev/null +++ b/src/ui/FormLabel/FormLabel.tsx @@ -0,0 +1,21 @@ +import React, { ReactNode } from 'react' + +interface FormLabelProps { + label: string + icon?: ReactNode +} + +const FormLabel: React.FC = ({ label, icon }) => { + return ( + + {icon && ( + + {icon} + + )} + {label} + + ) +} + +export default FormLabel diff --git a/src/ui/FormLabel/index.js b/src/ui/FormLabel/index.js new file mode 100644 index 0000000000..3510f20f24 --- /dev/null +++ b/src/ui/FormLabel/index.js @@ -0,0 +1 @@ +export { default } from './FormLabel'