Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 29 additions & 4 deletions codex-webview/src/views/components/Context.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,10 @@
</div>

{/if}
<div class="text-gray-400">
<div class="min-w-0 flex-1 flex flex-row items-start">
<div class="flex-auto">
<AuthorDetails createdAt={context.createdAt} createdBy={context.createdBy} />
<div class="text-gray-400 context-metadata">
<div class="min-w-0 flex-1 flex flex-row items-start context-metadata__wrapper">
<div class="context-metadata__heading">
<AuthorDetails createdAt={context.createdAt} createdBy={context.createdBy} containerClass="flex"/>
<InlineScope contextId={context.id} scope={context.contextInstances[0].scope} codexId={context.codexId} />
</div>

Expand Down Expand Up @@ -179,4 +179,29 @@
.button-wrapper {
margin-bottom: 1em;
}
.context-metadata__heading {
display: flex;
flex-direction: column;
align-items: flex-start;
max-width: calc(100% - 4em);
}
.context-metadata__header {
vertical-align: middle;
text-overflow: ellipsis;
white-space: nowrap;
direction: rtl;
Copy link
Copy Markdown
Contributor

@cpul cpul Jul 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason your filename is far off from the left is because of this direction property.
I believe what you need to do here is to rearrange the styles to get the desired effect.
Essentially, you want something like this (I'll use a basic example of the above):

<div class="context-metadata">
  <div class="context-metadata__wrapper">
    <div class="context-metadata__header"> <-- remove ellipsis stuff; make this a column-direction flexbox
      <AuthorDetails />
      <InlineScope /> <-- apply the ellipsis and direction styles to the wrapping parent element around the link here
    </div>
  </div>
</div>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Chris === CSS Guru 😁

overflow: hidden;
margin-left: 0;
}
.context-metadata {
display: flex;
justify-content: space-between;
align-items: center;
}
.context-metadata__wrapper {
display: flex;
align-items: center;
width: calc(50% - 2em);
gap: 0.5em;
}
</style>
32 changes: 27 additions & 5 deletions codex-webview/src/views/components/InlineScope.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,30 @@
});
};
</script>
{#if scope?.file}
<a href="/#" class={`inline-scope text-md ${$$props.class}`} on:click={navigateToLine}>
{scope.file?.name}{ scope.startLine && scope.endLine ? `#[L${scope.startLine}:L${scope.endLine}]` : "" }
</a>
{/if}

<container class="inline-scope__wrapper">
{#if scope?.file}
<div class="inline-scope__file">
<a href="/#" class={`page-header__text inline-scope__link text-md ${$$props.class}`} on:click={navigateToLine}>
{scope.file?.name}{ scope.startLine && scope.endLine ? `#[L${scope.startLine}:L${scope.endLine}]` : "" }
</a>
</div>
{/if}
</container>

<style>
.inline-scope__wrapper {
width: 100%;
}
.inline-scope__file {
display: flex;
width: 100%;
}
.inline-scope__link {
vertical-align: middle;
text-overflow: ellipsis;
white-space: nowrap;
direction: rtl;
overflow: hidden;
}
</style>