diff --git a/src/blocks/Map/Map.scss b/src/blocks/Map/Map.scss new file mode 100644 index 000000000..87548c9e9 --- /dev/null +++ b/src/blocks/Map/Map.scss @@ -0,0 +1,7 @@ +@import '../../../styles/mixins'; + +$block: '.#{$ns}map-block'; + +#{$block} { + @include media-border(); +} diff --git a/src/blocks/Map/Map.tsx b/src/blocks/Map/Map.tsx index 5f0e3125e..d3d8ea7e8 100644 --- a/src/blocks/Map/Map.tsx +++ b/src/blocks/Map/Map.tsx @@ -3,13 +3,26 @@ import React from 'react'; import Map from '../../components/Map/Map'; import MediaBase from '../../components/MediaBase/MediaBase'; import {MapBlockProps} from '../../models'; +import {block} from '../../utils'; +import {getMediaBorder} from '../../utils/borderSelector'; -export const MapBlock = ({map, ...props}: MapBlockProps) => ( - - - - - -); +import './Map.scss'; + +const b = block('map-block'); + +export const MapBlock = ({map, border, disableShadow, ...props}: MapBlockProps) => { + const borderSelected = getMediaBorder({ + border, + disableShadow, + }); + + return ( + + + + + + ); +}; export default MapBlock; diff --git a/src/blocks/Map/__stories__/Map.mdx b/src/blocks/Map/__stories__/Map.mdx index 54dc37599..24f74fc8c 100644 --- a/src/blocks/Map/__stories__/Map.mdx +++ b/src/blocks/Map/__stories__/Map.mdx @@ -24,7 +24,7 @@ import * as MapStories from './Map.stories.tsx'; `largeMedia?: boolean` — An image/video takes 8 columns. -`disableShadow?: boolean` — Disable shadow for the block. +`border?: 'shadow' | 'line' | 'none` — Select border of the block. `additionalInfo?: string` — Gray text (with YFM support) diff --git a/src/blocks/Media/Media.scss b/src/blocks/Media/Media.scss new file mode 100644 index 000000000..523fdd2fb --- /dev/null +++ b/src/blocks/Media/Media.scss @@ -0,0 +1,7 @@ +@import '../../../styles/mixins'; + +$block: '.#{$ns}media-block'; + +#{$block} { + @include media-border(); +} diff --git a/src/blocks/Media/Media.tsx b/src/blocks/Media/Media.tsx index d361f0ead..a0079b0d7 100644 --- a/src/blocks/Media/Media.tsx +++ b/src/blocks/Media/Media.tsx @@ -4,10 +4,19 @@ import Media from '../../components/Media/Media'; import MediaBase from '../../components/MediaBase/MediaBase'; import {useTheme} from '../../context/theme'; import {MediaBlockProps} from '../../models'; -import {getThemedValue} from '../../utils'; +import {block, getThemedValue} from '../../utils'; +import {getMediaBorder} from '../../utils/borderSelector'; + +import './Media.scss'; + +const b = block('media-block'); export const MediaBlock = (props: MediaBlockProps) => { - const {media} = props; + const {media, border, disableShadow} = props; + const borderSelected = getMediaBorder({ + border, + disableShadow, + }); const [play, setPlay] = useState(false); const theme = useTheme(); @@ -16,7 +25,7 @@ export const MediaBlock = (props: MediaBlockProps) => { return ( setPlay(true)}> - + ); diff --git a/src/blocks/Media/__stories__/Media.mdx b/src/blocks/Media/__stories__/Media.mdx index 6b64089dd..9bf5cfd18 100644 --- a/src/blocks/Media/__stories__/Media.mdx +++ b/src/blocks/Media/__stories__/Media.mdx @@ -21,7 +21,7 @@ import * as MediaStories from './Media.stories.tsx'; `largeMedia?: boolean` — An image/video takes 8 columns. -`disableShadow?: boolean` — Disable shadow for the block. +`border?: 'shadow' | 'line' | 'none` — Select border of the block. `additionalInfo?: string` — Gray text (with YFM support) @@ -33,4 +33,6 @@ import * as MediaStories from './Media.stories.tsx'; [`buttons?: Button[]` — An array with button objects](?path=/docs/documentation-types--docs#button) +`border?: 'shadow' | 'line' | 'none'` — Image border + diff --git a/src/blocks/Media/__stories__/Media.stories.tsx b/src/blocks/Media/__stories__/Media.stories.tsx index 7dfe78c74..d645f3165 100644 --- a/src/blocks/Media/__stories__/Media.stories.tsx +++ b/src/blocks/Media/__stories__/Media.stories.tsx @@ -193,7 +193,9 @@ export const Video = VideoTemplate.bind({}); export const DataLens = ImageSliderTemplate.bind({}); export const Size = SizeTemplate.bind({}); export const Direction = DirectionTemplate.bind({}); +export const WithoutShadowDeprecated = ImageSliderTemplate.bind({}); export const WithoutShadow = ImageSliderTemplate.bind({}); +export const WithBorder = ImageSliderTemplate.bind({}); export const Iframe = IframeTemplate.bind({}); const DefaultArgs = { @@ -214,11 +216,21 @@ DataLens.args = { } as MediaBlockProps; Size.args = DefaultArgs as MediaBlockProps; Direction.args = DefaultArgs as MediaBlockProps; -WithoutShadow.args = { +WithoutShadowDeprecated.args = { ...DefaultArgs, ...data.withoutShadow.content, disableShadow: true, } as MediaBlockProps; +WithoutShadow.args = { + ...DefaultArgs, + ...data.withoutShadow.content, + border: 'none', +} as MediaBlockProps; +WithBorder.args = { + ...DefaultArgs, + ...data.withoutShadow.content, + border: 'line', +} as MediaBlockProps; Iframe.args = { ...DefaultArgs, } as MediaBlockProps; diff --git a/src/blocks/Media/schema.ts b/src/blocks/Media/schema.ts index 3379e72e2..adf596ab2 100644 --- a/src/blocks/Media/schema.ts +++ b/src/blocks/Media/schema.ts @@ -42,11 +42,18 @@ export const MediaBlockBaseProps = { mediaOnly: { type: 'boolean', }, + /** + * @deprecated use border='none' or border='line' instead + */ disableShadow: { type: 'boolean', }, button: ButtonBlock, mediaOnlyColSizes: containerSizesObject, + border: { + type: 'string', + enum: ['shadow', 'line', 'none'], + }, }; export const MediaBlock = { diff --git a/src/components/Map/GoogleMap.tsx b/src/components/Map/GoogleMap.tsx index 9641023d3..395b6301e 100644 --- a/src/components/Map/GoogleMap.tsx +++ b/src/components/Map/GoogleMap.tsx @@ -30,7 +30,7 @@ function getScriptSrc(params: GoogleMapLinkParams) { } const GoogleMap: React.FC = (props) => { - const {address, zoom} = props; + const {address, zoom, className} = props; const {apiKey, scriptSrc} = useContext(MapsContext); const {lang = Lang.Ru} = useContext(LocaleContext); const isMobile = useContext(MobileContext); @@ -63,7 +63,7 @@ const GoogleMap: React.FC = (props) => { return (