fix(ui): close sidebar on mobile when clicking version status

pull/1280/head
sct 4 years ago
parent dad37e8be6
commit ad67381397
No known key found for this signature in database
GPG Key ID: 77D146606D30DCCD

@ -174,7 +174,7 @@ const Sidebar: React.FC<SidebarProps> = ({ open, setClosed }) => {
</div>
<div
ref={navRef}
className="flex flex-col flex-1 h-0 pt-5 pb-4 overflow-y-auto"
className="flex flex-col flex-1 h-0 pt-5 pb-8 overflow-y-auto sm:pb-4"
>
<div className="flex items-center flex-shrink-0 px-4">
<span className="text-xl text-gray-50">
@ -223,7 +223,9 @@ const Sidebar: React.FC<SidebarProps> = ({ open, setClosed }) => {
);
})}
</nav>
{hasPermission(Permission.ADMIN) && <VersionStatus />}
{hasPermission(Permission.ADMIN) && (
<VersionStatus onClick={() => setClosed()} />
)}
</div>
</div>
<div className="flex-shrink-0 w-14">

@ -12,7 +12,11 @@ const messages = defineMessages({
'{commitsBehind} {commitsBehind, plural, one {commit} other {commits}} behind',
});
const VersionStatus: React.FC = () => {
interface VersionStatusProps {
onClick?: () => void;
}
const VersionStatus: React.FC<VersionStatusProps> = ({ onClick }) => {
const intl = useIntl();
const { data } = useSWR<StatusResponse>('/api/v1/status', {
refreshInterval: 60 * 1000,
@ -32,6 +36,14 @@ const VersionStatus: React.FC = () => {
return (
<Link href="/settings/about">
<a
onClick={onClick}
onKeyDown={(e) => {
if (e.key === 'Enter' && onClick) {
onClick();
}
}}
role="button"
tabIndex={0}
className={`flex items-center p-2 mx-2 text-xs transition duration-300 rounded-lg ring-1 ring-gray-700 ${
data.updateAvailable
? 'bg-yellow-500 text-white hover:bg-yellow-400'

Loading…
Cancel
Save