Skip to content

Commit

Permalink
chore: moved imageView to seperate component
Browse files Browse the repository at this point in the history
  • Loading branch information
mheggelund committed Sep 21, 2023
1 parent 612e3b2 commit 84b8f84
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 27 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import styled from 'styled-components'
import { spacings } from '../../../tokens/spacings'
import { theme } from '../../../tokens/theme'
import { spacings } from '../../tokens/spacings'
import { theme } from '../../tokens/theme'

export const ImageWrapper = styled.div`
display: flex;
Expand All @@ -12,24 +12,17 @@ export const ImageWrapper = styled.div`
border-color: ${theme.light.ui.background.medium};
max-width: 100%;
height: 100%;
height: fit-content;
> h5 {
font-weight: normal;
margin: 0;
padding: ${spacings.SMALL};
}
> .metadata-image {
> .image {
max-width: 100%;
padding: ${spacings.SMALL};
}
@media (max-width: 1350px) {
max-width: 100%;
> .metadata-image {
max-width: 100%;
}
}
`
18 changes: 18 additions & 0 deletions src/components/ImageView/ImageView.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import * as Styled from './ImageView.styled'

export const ImageView = ({
text,
img,
altText,
}: {
text: string
img: string
altText: string
}) => {
return (
<Styled.ImageWrapper>
<img className="image" alt={altText} src={img} />
<h5>{text}</h5>
</Styled.ImageWrapper>
)
}
13 changes: 0 additions & 13 deletions src/features/ModelView/ModelImageView/ModelImageView.tsx

This file was deleted.

9 changes: 7 additions & 2 deletions src/features/ModelView/ModelView.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { ModelImageView } from '../../features/ModelView/ModelImageView/ModelImageView'
import { ImageView } from '../../components/ImageView/ImageView'
import { ModelMetadataView } from '../../features/ModelView/ModelMetadataView/ModelMetadataView'
import { ModelSourceView } from '../../features/ModelView/ModelSourceView/ModelSourceView'
import * as Styled from './ModelView.styled'
import Img from './image.png'

export const ModelView = () => {
return (
Expand All @@ -10,7 +11,11 @@ export const ModelView = () => {
<ModelMetadataView />
<ModelSourceView />
</Styled.InnerMetadataWrapper>
<ModelImageView />
<ImageView
text="Model placeholder image"
img={Img}
altText="Model placeholder image"
/>
</Styled.MetadataWrapper>
)
}

0 comments on commit 84b8f84

Please sign in to comment.