Skip to content

Commit

Permalink
feat: improve branch selector styles and create branch/tag dialogs (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewgolovanov authored Feb 28, 2025
1 parent 9ee4846 commit 0e79235
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { FC } from 'react'

import { Button, DropdownMenu, Icon, Text } from '@/components'
import { Button, DropdownMenu, Icon } from '@/components'
import { BranchSelectorListItem, BranchSelectorTab, IBranchSelectorStore, TranslationStore } from '@/views'

import { BranchSelectorDropdown } from './branch-selector-dropdown'
Expand All @@ -9,13 +9,13 @@ interface BranchSelectorProps {
useRepoBranchesStore: () => IBranchSelectorStore
useTranslationStore: () => TranslationStore
branchPrefix?: string
buttonSize?: 'default' | 'sm' | 'md'
selectedBranch?: BranchSelectorListItem
onSelectBranch: (branchTag: BranchSelectorListItem, type: BranchSelectorTab) => void
isBranchOnly?: boolean
searchQuery?: string
setSearchQuery: (query: string) => void
dynamicWidth?: boolean
buttonSize?: 'default' | 'sm' | 'md'
}
export const BranchSelector: FC<BranchSelectorProps> = ({
useRepoBranchesStore,
Expand Down Expand Up @@ -46,12 +46,12 @@ export const BranchSelector: FC<BranchSelectorProps> = ({
{!branchPrefix && (
<Icon className="shrink-0 fill-transparent text-icons-9" name={isTag ? 'tag' : 'branch'} size={14} />
)}
<Text className="w-full text-foreground-8" truncate align="left">
<span className="w-full truncate text-left text-foreground-8">
{branchPrefix
? `${branchPrefix}: ${selectedBranch?.name || selectedBranchTag.name}`
: selectedBranch?.name || selectedBranchTag.name}
</Text>
<Icon name="chevron-down" className="chevron-down text-icons-2" size={20} />
</span>
<Icon name="chevron-down" className="chevron-down shrink-0 text-icons-2" size={12} />
</Button>
</DropdownMenu.Trigger>
<BranchSelectorDropdown
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export function CreateBranchDialog({
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [isSubmitSuccessful, open, onClose])

const handleClose = () => {
clearErrors()
setValue('name', '', { shouldValidate: false })
Expand Down Expand Up @@ -95,6 +96,7 @@ export function CreateBranchDialog({

<Fieldset>
<ControlGroup>
{/* TODO: Currently the search within BranchSelector is not working, we need to review the current passed states for it to work */}
<BranchSelector
useRepoBranchesStore={useRepoBranchesStore}
useTranslationStore={useTranslationStore}
Expand All @@ -103,9 +105,9 @@ export function CreateBranchDialog({
setSelectedBranchTag(value)
}}
setSearchQuery={handleChangeSearchValue}
dynamicWidth
buttonSize="md"
isBranchOnly
dynamicWidth
/>
</ControlGroup>
</Fieldset>
Expand All @@ -122,9 +124,7 @@ export function CreateBranchDialog({
<Button
variant="outline"
type="button"
onClick={() => {
handleClose()
}}
onClick={handleClose}
loading={isCreatingBranch}
disabled={isCreatingBranch}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ export function CreateTagDialog({
}}
searchQuery={branchQuery}
setSearchQuery={setBranchQuery}
dynamicWidth
buttonSize="md"
dynamicWidth
/>
</ControlGroup>
</Fieldset>
Expand Down

0 comments on commit 0e79235

Please sign in to comment.