wide picture support back

This commit is contained in:
tmshv committed 2021-09-21 16:23:24 +03:00
1 parent a55d474336
commit 0249c5873b
6 files changed
+15 -7

No files matched your search

+1
View File
@@ -121,6 +121,7 @@ const Index: NextPage<Props> = props => {
width={x.data.width}
height={x.data.height}
caption={x.data.caption}
wide={x.wide}
/>
)
+4 -2
View File
@@ -25,14 +25,16 @@ function size(w: number, h: number, tolerance: number) {
export type PictureProps = Pic & {
style?: React.CSSProperties
wide?: boolean
}
export const Picture: React.FC<PictureProps> = memo(props => {
export const Picture: React.FC<PictureProps> = memo(({ wide = false, ...props }) => {
const ss = size(props.width, props.height, 0.95)
const layout = modifiers.get(ss)
const w = ss === 'horizontal' ? wide : false
return (
<figure className={`${s.pic} ${layout}`}>
<figure className={`${s.pic} ${layout} ${w ? s.wide : ''}`}>
<Image
src={props.src}
alt={props.alt}
+6 -3
View File
@@ -1,10 +1,13 @@
.pic {
/* position: relative; */
/* width: calc(100% + var(--kazimir-image-increase)); */
/* margin-left: calc(-0.5 * var(--kazimir-image-increase)); */
margin-bottom: var(--size-xl);
}
.pic.wide {
position: relative;
width: calc(100% + var(--picture-wide-increase));
margin-left: calc(-0.5 * var(--picture-wide-increase));
}
.pic.vertical {
max-width: 60%;
}
+1
View File
@@ -50,6 +50,7 @@ export function createPageTokens(components: StrapiComponent[]): Token[] {
case 'hudozka.image': {
return {
token: 'image',
wide: component.wide,
data: {
alt: component.caption,
caption: component.caption,
+2 -2
View File
@@ -53,7 +53,7 @@
/* KAZIMIR */
--kazimir-caption-margin: 0px;
--kazimir-image-increase: 50px;
--picture-wide-increase: 100px;
}
* {
@@ -183,7 +183,7 @@ a.invisible {
--content-margin: var(--size-m);
--content-wide-margin: var(--size-m) var(--size-m);
--kazimir-image-increase: 0px;
--picture-wide-increase: 0px;
}
}
+1
View File
@@ -113,6 +113,7 @@ export type TextToken = {
export type ImageToken = {
token: 'image'
wide: boolean
data: Pic
}