Skip to content

Commit

Permalink
improve truncation styles on sidebar workspace/environment/cookies (K…
Browse files Browse the repository at this point in the history
  • Loading branch information
gatzjames authored and jackkav committed Mar 13, 2024
1 parent 03a665f commit aa5788f
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ export const WorkspaceDropdown: FC = () => {
<Button
aria-label="Workspace actions"
data-testid="workspace-context-dropdown"
className="px-3 py-1 h-7 flex flex-1 items-center justify-center gap-2 aria-pressed:bg-[--hl-sm] rounded-sm text-[--color-font] hover:bg-[--hl-xs] focus:ring-inset ring-1 ring-transparent focus:ring-[--hl-md] transition-all text-sm"
className="px-3 py-1 h-7 flex flex-1 items-center justify-center gap-2 aria-pressed:bg-[--hl-sm] rounded-sm text-[--color-font] hover:bg-[--hl-xs] focus:ring-inset ring-1 ring-transparent focus:ring-[--hl-md] transition-all text-sm truncate"
>
<span className="truncate">{activeWorkspaceName}</span>
<Icon icon="caret-down" />
Expand Down
15 changes: 9 additions & 6 deletions packages/insomnia/src/ui/routes/debug.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ export const Debug: FC = () => {
renderPageSidebar={
<div className="flex flex-1 flex-col overflow-hidden divide-solid divide-y divide-[--hl-md]">
<div className="flex flex-col items-start gap-2 justify-between p-[--padding-sm]">
<Breadcrumbs className='flex flex-wrap list-none items-center m-0 p-0 gap-2 pb-[--padding-sm] border-b border-solid border-[--hl-sm] font-bold w-full'>
<Breadcrumbs className='flex list-none items-center m-0 p-0 gap-2 pb-[--padding-sm] border-b border-solid border-[--hl-sm] font-bold w-full'>
<Breadcrumb className="flex select-none items-center gap-2 text-[--color-font] h-full outline-none data-[focused]:outline-none">
<NavLink
data-testid="project"
Expand All @@ -649,13 +649,14 @@ export const Debug: FC = () => {
</NavLink>
<span aria-hidden role="separator" className='text-[--hl-lg] h-4 outline outline-1' />
</Breadcrumb>
<Breadcrumb className="flex select-none items-center gap-2 text-[--color-font] h-full outline-none data-[focused]:outline-none">
<Breadcrumb className="flex truncate select-none items-center gap-2 text-[--color-font] h-full outline-none data-[focused]:outline-none">
<WorkspaceDropdown />
</Breadcrumb>
</Breadcrumbs>
<div className="flex w-full items-center gap-2 justify-between">
<Select
aria-label="Select an environment"
className="overflow-hidden"
onSelectionChange={environmentId => {
setActiveEnvironmentFetcher.submit(
{
Expand All @@ -669,7 +670,7 @@ export const Debug: FC = () => {
}}
selectedKey={activeEnvironment._id}
>
<Button className="px-4 py-1 flex flex-1 items-center justify-center gap-2 aria-pressed:bg-[--hl-sm] rounded-sm text-[--color-font] hover:bg-[--hl-xs] focus:ring-inset ring-1 ring-transparent focus:ring-[--hl-md] transition-all text-sm">
<Button className="px-4 py-1 flex flex-1 items-center justify-center gap-2 aria-pressed:bg-[--hl-sm] rounded-sm text-[--color-font] hover:bg-[--hl-xs] focus:ring-inset ring-1 ring-transparent focus:ring-[--hl-md] transition-all text-sm overflow-hidden w-full">
<SelectValue<Environment> className="flex truncate items-center justify-center gap-2">
{({ isPlaceholder, selectedItem }) => {
if (
Expand All @@ -687,7 +688,9 @@ export const Debug: FC = () => {
>
<Icon className='text-xs w-5' icon="refresh" />
</span>
{baseEnvironment.name}
<span className='truncate'>
{baseEnvironment.name}
</span>
</Fragment>
);
}
Expand Down Expand Up @@ -773,10 +776,10 @@ export const Debug: FC = () => {
</div>
<Button
onPress={() => setIsCookieModalOpen(true)}
className="px-4 py-1 flex-1 flex items-center justify-center gap-2 aria-pressed:bg-[--hl-sm] rounded-sm text-[--color-font] hover:bg-[--hl-xs] focus:ring-inset ring-1 ring-transparent focus:ring-[--hl-md] transition-all text-sm"
className="px-4 py-1 max-w-full truncate flex-1 flex items-center justify-center gap-2 aria-pressed:bg-[--hl-sm] rounded-sm text-[--color-font] hover:bg-[--hl-xs] focus:ring-inset ring-1 ring-transparent focus:ring-[--hl-md] transition-all text-sm"
>
<Icon icon="cookie-bite" className='w-5' />
{activeCookieJar.cookies.length === 0 ? 'Add' : 'Manage'} Cookies
<span className='truncate'>{activeCookieJar.cookies.length === 0 ? 'Add' : 'Manage'} Cookies</span>
</Button>
</div>

Expand Down
15 changes: 9 additions & 6 deletions packages/insomnia/src/ui/routes/design.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ const Design: FC = () => {
renderPageSidebar={
<div className='flex h-full flex-col divide-y divide-solid divide-[--hl-md] overflow-hidden'>
<div className="flex flex-col items-start gap-2 justify-between p-[--padding-sm]">
<Breadcrumbs className='flex flex-wrap list-none items-center m-0 p-0 gap-2 pb-[--padding-sm] border-b border-solid border-[--hl-sm] font-bold w-full'>
<Breadcrumbs className='flex list-none items-center m-0 p-0 gap-2 pb-[--padding-sm] border-b border-solid border-[--hl-sm] font-bold w-full'>
<Breadcrumb className="flex select-none items-center gap-2 text-[--color-font] h-full outline-none data-[focused]:outline-none">
<NavLink
data-testid="project"
Expand All @@ -405,13 +405,14 @@ const Design: FC = () => {
</NavLink>
<span aria-hidden role="separator" className='text-[--hl-lg] h-4 outline outline-1' />
</Breadcrumb>
<Breadcrumb className="flex select-none items-center gap-2 text-[--color-font] h-full outline-none data-[focused]:outline-none">
<Breadcrumb className="flex truncate select-none items-center gap-2 text-[--color-font] h-full outline-none data-[focused]:outline-none">
<WorkspaceDropdown />
</Breadcrumb>
</Breadcrumbs>
<div className="flex w-full items-center gap-2 justify-between">
<Select
aria-label="Select an environment"
className="overflow-hidden"
onSelectionChange={environmentId => {
setActiveEnvironmentFetcher.submit(
{
Expand All @@ -425,7 +426,7 @@ const Design: FC = () => {
}}
selectedKey={activeEnvironment._id}
>
<Button className="px-4 py-1 flex flex-1 items-center justify-center gap-2 aria-pressed:bg-[--hl-sm] rounded-sm text-[--color-font] hover:bg-[--hl-xs] focus:ring-inset ring-1 ring-transparent focus:ring-[--hl-md] transition-all text-sm">
<Button className="px-4 py-1 flex flex-1 items-center justify-center gap-2 aria-pressed:bg-[--hl-sm] rounded-sm text-[--color-font] hover:bg-[--hl-xs] focus:ring-inset ring-1 ring-transparent focus:ring-[--hl-md] transition-all text-sm overflow-hidden w-full">
<SelectValue<Environment> className="flex truncate items-center justify-center gap-2">
{({ isPlaceholder, selectedItem }) => {
if (
Expand All @@ -443,7 +444,9 @@ const Design: FC = () => {
>
<Icon className='text-xs w-5' icon="refresh" />
</span>
{baseEnvironment.name}
<span className='truncate'>
{baseEnvironment.name}
</span>
</Fragment>
);
}
Expand Down Expand Up @@ -529,10 +532,10 @@ const Design: FC = () => {
</div>
<Button
onPress={() => setIsCookieModalOpen(true)}
className="px-4 py-1 flex-1 flex items-center justify-center gap-2 aria-pressed:bg-[--hl-sm] rounded-sm text-[--color-font] hover:bg-[--hl-xs] focus:ring-inset ring-1 ring-transparent focus:ring-[--hl-md] transition-all text-sm"
className="px-4 py-1 max-w-full truncate flex-1 flex items-center justify-center gap-2 aria-pressed:bg-[--hl-sm] rounded-sm text-[--color-font] hover:bg-[--hl-xs] focus:ring-inset ring-1 ring-transparent focus:ring-[--hl-md] transition-all text-sm"
>
<Icon icon="cookie-bite" className='w-5' />
{activeCookieJar.cookies.length === 0 ? 'Add' : 'Manage'} Cookies
<span className='truncate'>{activeCookieJar.cookies.length === 0 ? 'Add' : 'Manage'} Cookies</span>
</Button>
</div>
<div className="flex flex-shrink-0 items-center gap-2 p-[--padding-sm]">
Expand Down
15 changes: 9 additions & 6 deletions packages/insomnia/src/ui/routes/unit-test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ const TestRoute: FC = () => {
<ErrorBoundary showAlert>
<div className="flex flex-1 flex-col overflow-hidden divide-solid divide-y divide-[--hl-md]">
<div className="flex flex-col items-start gap-2 justify-between p-[--padding-sm]">
<Breadcrumbs className='flex flex-wrap list-none items-center m-0 p-0 gap-2 pb-[--padding-sm] border-b border-solid border-[--hl-sm] font-bold w-full'>
<Breadcrumbs className='flex list-none items-center m-0 p-0 gap-2 pb-[--padding-sm] border-b border-solid border-[--hl-sm] font-bold w-full'>
<Breadcrumb className="flex select-none items-center gap-2 text-[--color-font] h-full outline-none data-[focused]:outline-none">
<NavLink
data-testid="project"
Expand All @@ -193,13 +193,14 @@ const TestRoute: FC = () => {
</NavLink>
<span aria-hidden role="separator" className='text-[--hl-lg] h-4 outline outline-1' />
</Breadcrumb>
<Breadcrumb className="flex select-none items-center gap-2 text-[--color-font] h-full outline-none data-[focused]:outline-none">
<Breadcrumb className="flex truncate select-none items-center gap-2 text-[--color-font] h-full outline-none data-[focused]:outline-none">
<WorkspaceDropdown />
</Breadcrumb>
</Breadcrumbs>
<div className="flex w-full items-center gap-2 justify-between">
<Select
aria-label="Select an environment"
className="overflow-hidden"
onSelectionChange={environmentId => {
setActiveEnvironmentFetcher.submit(
{
Expand All @@ -213,7 +214,7 @@ const TestRoute: FC = () => {
}}
selectedKey={activeEnvironment._id}
>
<Button className="px-4 py-1 flex flex-1 items-center justify-center gap-2 aria-pressed:bg-[--hl-sm] rounded-sm text-[--color-font] hover:bg-[--hl-xs] focus:ring-inset ring-1 ring-transparent focus:ring-[--hl-md] transition-all text-sm">
<Button className="px-4 py-1 flex flex-1 items-center justify-center gap-2 aria-pressed:bg-[--hl-sm] rounded-sm text-[--color-font] hover:bg-[--hl-xs] focus:ring-inset ring-1 ring-transparent focus:ring-[--hl-md] transition-all text-sm overflow-hidden w-full">
<SelectValue<Environment> className="flex truncate items-center justify-center gap-2">
{({ isPlaceholder, selectedItem }) => {
if (
Expand All @@ -231,7 +232,9 @@ const TestRoute: FC = () => {
>
<Icon className='text-xs w-5' icon="refresh" />
</span>
{baseEnvironment.name}
<span className='truncate'>
{baseEnvironment.name}
</span>
</Fragment>
);
}
Expand Down Expand Up @@ -317,10 +320,10 @@ const TestRoute: FC = () => {
</div>
<Button
onPress={() => setIsCookieModalOpen(true)}
className="px-4 py-1 flex-1 flex items-center justify-center gap-2 aria-pressed:bg-[--hl-sm] rounded-sm text-[--color-font] hover:bg-[--hl-xs] focus:ring-inset ring-1 ring-transparent focus:ring-[--hl-md] transition-all text-sm"
className="px-4 py-1 max-w-full truncate flex-1 flex items-center justify-center gap-2 aria-pressed:bg-[--hl-sm] rounded-sm text-[--color-font] hover:bg-[--hl-xs] focus:ring-inset ring-1 ring-transparent focus:ring-[--hl-md] transition-all text-sm"
>
<Icon icon="cookie-bite" className='w-5' />
{activeCookieJar.cookies.length === 0 ? 'Add' : 'Manage'} Cookies
<span className='truncate'>{activeCookieJar.cookies.length === 0 ? 'Add' : 'Manage'} Cookies</span>
</Button>
</div>
<div className="p-[--padding-sm]">
Expand Down

0 comments on commit aa5788f

Please sign in to comment.