Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Banner property new action for tablet devices #95

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

### Added

- Banner option on tablet devices

## [2.11.5] - 2019-12-18

### Added
Expand Down
3 changes: 2 additions & 1 deletion messages/context.json
Expand Up @@ -20,5 +20,6 @@
"admin/editor.carousel.banner.description.title": "admin/editor.carousel.banner.description.title",
"admin/editor.carousel.banner.externalRoute.title": "admin/editor.carousel.banner.externalRoute.title",
"admin/editor.carousel.banner.image.title": "admin/editor.carousel.banner.image.title",
"admin/editor.carousel.banner.mobileImage.title": "admin/editor.carousel.banner.mobileImage.title"
"admin/editor.carousel.banner.mobileImage.title": "admin/editor.carousel.banner.mobileImage.title",
"admin/editor.carousel.banner.tabletImage.title": "admin/editor.carousel.banner.tabletImage.title"
}
5 changes: 4 additions & 1 deletion messages/en.json
Expand Up @@ -20,5 +20,8 @@
"admin/editor.carousel.banner.description.title": "Banner description",
"admin/editor.carousel.banner.externalRoute.title": "External route",
"admin/editor.carousel.banner.image.title": "Banner image",
"admin/editor.carousel.banner.mobileImage.title": "Banner mobile image"
"admin/editor.carousel.banner.mobileImage.title": "Banner mobile image",
"admin/editor.carousel.banner.tabletImage.title": "Bbanner tablet image"


}
3 changes: 2 additions & 1 deletion messages/es.json
Expand Up @@ -20,5 +20,6 @@
"admin/editor.carousel.banner.description.title": "Descripción del banner",
"admin/editor.carousel.banner.externalRoute.title": "Ruta externa",
"admin/editor.carousel.banner.image.title": "Imagen del banner",
"admin/editor.carousel.banner.mobileImage.title": "Imagen del banner en el móvil"
"admin/editor.carousel.banner.mobileImage.title": "Imagen del banner en el móvil",
"admin/editor.carousel.banner.tabletImage.title": "Imagen del banner en tablet"
}
3 changes: 2 additions & 1 deletion messages/pt.json
Expand Up @@ -20,5 +20,6 @@
"admin/editor.carousel.banner.description.title": "Descrição do banner",
"admin/editor.carousel.banner.externalRoute.title": "Rota externa",
"admin/editor.carousel.banner.image.title": "Imagem do banner",
"admin/editor.carousel.banner.mobileImage.title": "Imagem do banner no mobile"
"admin/editor.carousel.banner.mobileImage.title": "Imagem do banner no mobile",
"admin/editor.carousel.banner.tabletImage.title": "Imagem de banner para tablet"
}
9 changes: 6 additions & 3 deletions react/Banner.tsx
Expand Up @@ -27,7 +27,9 @@ export interface Props {
/** The url where the image is pointing to, in case of internal route (optional) */
customInternalURL: string
/** Runtime injected deps */
runtime: any
runtime: any,
/** Link for the tablet image of the banner */
tabletImage: string
}

function getParams(params: string) {
Expand All @@ -50,13 +52,14 @@ const Banner = (props: Props) => {
image,
params,
mobileImage,
tabletImage,
height = 420,
externalRoute,
description = '',
customInternalURL,
} = props

const { isMobile } = useDevice()
const { isMobile, device } = useDevice()
const handles = useCssHandles(CSS_HANDLES)

const content = (
Expand All @@ -70,7 +73,7 @@ const Banner = (props: Props) => {
>
<img
className={classnames(handles.img, 'w-100 h-100')}
src={isMobile && mobileImage ? mobileImage : image}
src={device === "tablet" ? tabletImage || image : isMobile && mobileImage ? mobileImage : image}
alt={description}
/>
</div>
Expand Down
8 changes: 8 additions & 0 deletions react/Carousel.tsx
Expand Up @@ -234,6 +234,14 @@ Carousel.getSchema = () => {
'ui:widget': 'image-uploader',
},
},
tabletImage: {
default: '',
title: 'admin/editor.carousel.banner.tabletImage.title',
type: 'string',
widget: {
'ui:widget': 'image-uploader',
},
},
description: {
default: '',
title: 'admin/editor.carousel.banner.description.title',
Expand Down