Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Part 1 of top bar UI refresh #603

Merged
merged 2 commits into from
Jan 24, 2022
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
14 changes: 11 additions & 3 deletions app/web/src/components/EditableProjecTitle/EditableProjecTitle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,25 @@ const EditableProjectTitle = ({
}
setNewTitle(target.value.replace(/([^a-zA-Z\d_:])/g, '-').slice(0, 25))
}
const onKeyDown = (event) => {
if (event.key === 'Enter') {
event.preventDefault();
event.stopPropagation();
updateProject({ variables: { id, input: { title: newTitle } } });
}
}
return (
<>
{!inEditMode && (
<>
<Link
/<Link
className="underline-hovered"
to={routes.project({
userName,
projectTitle,
})}
className="pl-4"
>
/{projectTitle}
{projectTitle}
</Link>
{canEdit && (
<button
Expand All @@ -76,6 +83,7 @@ const EditableProjectTitle = ({
value={newTitle}
onChange={onTitleChange}
ref={inputRef}
onKeyDown={onKeyDown}
onBlur={() =>
setTimeout(() => {
setInEditMode(false)
Expand Down
20 changes: 10 additions & 10 deletions app/web/src/components/IdeHeader/IdeHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ export default function IdeHeader({
<div className="flex h-full items-center text-gray-300">
{project?.id && (
<>
<span className="bg-ch-gray-700 h-full grid grid-flow-col-dense items-center gap-2 px-4">
<Gravatar image={project?.user?.image} className="w-10" />
<span className="h-full grid grid-flow-col-dense items-center gap-2 ml-4">
<Link
className="underline-hovered"
to={routes.user({
userName: projectOwner,
})}
Expand All @@ -129,7 +129,7 @@ export default function IdeHeader({
<TopButton
onClick={onClick}
name="Save Project Image"
className=" bg-ch-blue-650 bg-opacity-30 hover:bg-opacity-80 text-ch-gray-300"
className="bg-ch-blue-650 bg-opacity-30 hover:bg-opacity-80 text-ch-gray-300"
>
<Svg name="camera" className="w-6 h-6 text-ch-blue-400" />
</TopButton>
Expand All @@ -138,19 +138,19 @@ export default function IdeHeader({
)}
{!isProfile && (
<TopButton
className="bg-ch-pink-800 bg-opacity-30 hover:bg-opacity-80 text-ch-gray-300"
className="bg-ch-blue-650 bg-opacity-30 hover:bg-opacity-80 text-ch-gray-300"
onClick={handleRender}
name={canEdit ? 'Save' : 'Preview'}
>
<Svg
name={canEdit ? 'floppy-disk' : 'photograph'}
className="w-6 h-6 text-ch-pink-500"
className="w-6 h-6 text-ch-blue-400"
/>
</TopButton>
)}
{isProfile && (
<TopButton
className="bg-ch-pink-800 bg-opacity-30 hover:bg-opacity-80 text-ch-gray-300"
className="bg-ch-blue-650 bg-opacity-30 hover:bg-opacity-80 text-ch-gray-300"
onClick={() =>
navigate(
routes.ide({
Expand All @@ -161,7 +161,7 @@ export default function IdeHeader({
}
name="Editor"
>
<Svg name="terminal" className="w-6 h-6 text-ch-pink-500" />
<Svg name="terminal" className="w-6 h-6 text-ch-blue-400" />
</TopButton>
)}
<Popover className="relative outline-none w-full h-full">
Expand All @@ -172,11 +172,11 @@ export default function IdeHeader({
<TopButton
Tag="div"
name="Share"
className=" bg-ch-purple-400 bg-opacity-30 hover:bg-opacity-80 text-ch-gray-300"
className="bg-ch-blue-650 bg-opacity-30 hover:bg-opacity-80 text-ch-gray-300"
>
<Svg
name="share"
className="w-6 h-6 text-ch-purple-500 mt-1"
className="w-6 h-6 text-ch-blue-400 mt-1"
/>
</TopButton>
</Popover.Button>
Expand Down Expand Up @@ -221,7 +221,7 @@ export default function IdeHeader({
<div className="fixed bg-white w-60 h-10 top-16 right-24 z-10 rounded-md text-sm flex p-2 items-center">
<Svg
name="exclamation-circle"
className="w-8 h-8 mx-2 text-ch-blue-500"
className="w-8 h-8 mx-2 text-ch-blue-400"
/>{' '}
Fork to save your work
</div>
Expand Down
3 changes: 3 additions & 0 deletions app/web/src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -144,3 +144,6 @@ label {
input.error, textarea.error {
border: 1px solid red;
}
a.underline-hovered:hover {
text-decoration: underline;
}