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

This commit is contained in:
sct
2021-04-14 10:39:07 +09:00
parent dad37e8be6
commit ad67381397
2 changed files with 17 additions and 3 deletions

View File

@@ -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'