Skip to content
This repository has been archived by the owner on Feb 27, 2024. It is now read-only.

Commit

Permalink
♻️ #289 CreatedLgtmImage をCSSModules に置換え、それに加えて以下の変更を実施
Browse files Browse the repository at this point in the history
ESlintの以下のErrorを回避する為にaltテキストを追加

32:9  error  img elements must have an alt prop, either with meaningful text, or an empty string for decorative images  jsx-a11y/alt-text
  • Loading branch information
keitakn committed May 29, 2023
1 parent e6c2983 commit 2e0b458
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 22 deletions.
19 changes: 19 additions & 0 deletions src/components/Upload/UploadModal/CreatedLgtmImage.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
.wrapper {
flex: none;
flex-grow: 0;
order: 0;
}

.image {
flex: none;
flex-grow: 0;
order: 0;
width: auto;
height: 270px;
}

@media (max-width: 767px) {
.image {
max-width: 355px;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
declare const styles: {
readonly wrapper: string;
readonly image: string;
};
export = styles;
30 changes: 8 additions & 22 deletions src/components/Upload/UploadModal/CreatedLgtmImage.tsx
Original file line number Diff line number Diff line change
@@ -1,27 +1,9 @@
import type { FC } from 'react';
import styled from 'styled-components';
import { defaultAppUrl, type AppUrl } from '../../../constants';
import { useClipboardMarkdown, useCopySuccess } from '../../../hooks';
import { mixins } from '../../../styles';
import { type LgtmImageUrl } from '../../../types';
import { CopiedGithubMarkdownMessage } from '../../LgtmImages/CopiedGithubMarkdownMessage';

const _Wrapper = styled.div`
flex: none;
flex-grow: 0;
order: 0;
`;

const _Image = styled.img`
@media (max-width: ${mixins.mediaQuerySize.default}) {
max-width: 355px;
}
flex: none;
flex-grow: 0;
order: 0;
width: auto;
height: 270px;
`;
import styles from './CreatedLgtmImage.module.css';

type Props = {
imagePreviewUrl: string;
Expand All @@ -46,9 +28,13 @@ export const CreatedLgtmImage: FC<Props> = ({

return (
<>
<_Wrapper ref={imageContextRef}>
<_Image src={imagePreviewUrl} />
</_Wrapper>
<div ref={imageContextRef} className={styles.wrapper}>
<img
src={imagePreviewUrl}
className={styles.image}
alt="Uploaded cat"
/>
</div>
{copied ? <CopiedGithubMarkdownMessage /> : ''}
</>
);
Expand Down

0 comments on commit 2e0b458

Please sign in to comment.