Part 1 of top bar UI refresh #603
@@ -42,18 +42,25 @@ const EditableProjectTitle = ({
|
|||||||
}
|
}
|
||||||
setNewTitle(target.value.replace(/([^a-zA-Z\d_:])/g, '-').slice(0, 25))
|
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 (
|
return (
|
||||||
<>
|
<>
|
||||||
{!inEditMode && (
|
{!inEditMode && (
|
||||||
<>
|
<>
|
||||||
<Link
|
/<Link
|
||||||
|
className="underline-hovered"
|
||||||
to={routes.project({
|
to={routes.project({
|
||||||
userName,
|
userName,
|
||||||
projectTitle,
|
projectTitle,
|
||||||
})}
|
})}
|
||||||
className="pl-4"
|
|
||||||
>
|
>
|
||||||
/{projectTitle}
|
{projectTitle}
|
||||||
</Link>
|
</Link>
|
||||||
{canEdit && (
|
{canEdit && (
|
||||||
<button
|
<button
|
||||||
@@ -76,6 +83,7 @@ const EditableProjectTitle = ({
|
|||||||
value={newTitle}
|
value={newTitle}
|
||||||
onChange={onTitleChange}
|
onChange={onTitleChange}
|
||||||
ref={inputRef}
|
ref={inputRef}
|
||||||
|
onKeyDown={onKeyDown}
|
||||||
onBlur={() =>
|
onBlur={() =>
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
setInEditMode(false)
|
setInEditMode(false)
|
||||||
|
|||||||
@@ -102,9 +102,9 @@ export default function IdeHeader({
|
|||||||
<div className="flex h-full items-center text-gray-300">
|
<div className="flex h-full items-center text-gray-300">
|
||||||
{project?.id && (
|
{project?.id && (
|
||||||
<>
|
<>
|
||||||
<span className="bg-ch-gray-700 h-full grid grid-flow-col-dense items-center gap-2 px-4">
|
<span className="h-full grid grid-flow-col-dense items-center gap-2 ml-4">
|
||||||
<Gravatar image={project?.user?.image} className="w-10" />
|
|
||||||
<Link
|
<Link
|
||||||
|
className="underline-hovered"
|
||||||
to={routes.user({
|
to={routes.user({
|
||||||
userName: projectOwner,
|
userName: projectOwner,
|
||||||
})}
|
})}
|
||||||
@@ -129,7 +129,7 @@ export default function IdeHeader({
|
|||||||
<TopButton
|
<TopButton
|
||||||
onClick={onClick}
|
onClick={onClick}
|
||||||
name="Save Project Image"
|
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" />
|
<Svg name="camera" className="w-6 h-6 text-ch-blue-400" />
|
||||||
</TopButton>
|
</TopButton>
|
||||||
@@ -138,19 +138,19 @@ export default function IdeHeader({
|
|||||||
)}
|
)}
|
||||||
{!isProfile && (
|
{!isProfile && (
|
||||||
<TopButton
|
<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}
|
onClick={handleRender}
|
||||||
name={canEdit ? 'Save' : 'Preview'}
|
name={canEdit ? 'Save' : 'Preview'}
|
||||||
>
|
>
|
||||||
<Svg
|
<Svg
|
||||||
name={canEdit ? 'floppy-disk' : 'photograph'}
|
name={canEdit ? 'floppy-disk' : 'photograph'}
|
||||||
className="w-6 h-6 text-ch-pink-500"
|
className="w-6 h-6 text-ch-blue-400"
|
||||||
/>
|
/>
|
||||||
</TopButton>
|
</TopButton>
|
||||||
)}
|
)}
|
||||||
{isProfile && (
|
{isProfile && (
|
||||||
<TopButton
|
<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={() =>
|
onClick={() =>
|
||||||
navigate(
|
navigate(
|
||||||
routes.ide({
|
routes.ide({
|
||||||
@@ -161,7 +161,7 @@ export default function IdeHeader({
|
|||||||
}
|
}
|
||||||
name="Editor"
|
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>
|
</TopButton>
|
||||||
)}
|
)}
|
||||||
<Popover className="relative outline-none w-full h-full">
|
<Popover className="relative outline-none w-full h-full">
|
||||||
@@ -172,11 +172,11 @@ export default function IdeHeader({
|
|||||||
<TopButton
|
<TopButton
|
||||||
Tag="div"
|
Tag="div"
|
||||||
name="Share"
|
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
|
<Svg
|
||||||
name="share"
|
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>
|
</TopButton>
|
||||||
</Popover.Button>
|
</Popover.Button>
|
||||||
@@ -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">
|
<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
|
<Svg
|
||||||
name="exclamation-circle"
|
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
|
Fork to save your work
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -144,3 +144,6 @@ label {
|
|||||||
input.error, textarea.error {
|
input.error, textarea.error {
|
||||||
border: 1px solid red;
|
border: 1px solid red;
|
||||||
}
|
}
|
||||||
|
a.underline-hovered:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user