wide picture support back
This commit is contained in:
1 parent
a55d474336
commit
0249c5873b
6 files changed
+15
-7
No files matched your search
@@ -121,6 +121,7 @@ const Index: NextPage<Props> = props => {
|
|||||||
width={x.data.width}
|
width={x.data.width}
|
||||||
height={x.data.height}
|
height={x.data.height}
|
||||||
caption={x.data.caption}
|
caption={x.data.caption}
|
||||||
|
wide={x.wide}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -25,14 +25,16 @@ function size(w: number, h: number, tolerance: number) {
|
|||||||
|
|
||||||
export type PictureProps = Pic & {
|
export type PictureProps = Pic & {
|
||||||
style?: React.CSSProperties
|
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 ss = size(props.width, props.height, 0.95)
|
||||||
const layout = modifiers.get(ss)
|
const layout = modifiers.get(ss)
|
||||||
|
const w = ss === 'horizontal' ? wide : false
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<figure className={`${s.pic} ${layout}`}>
|
<figure className={`${s.pic} ${layout} ${w ? s.wide : ''}`}>
|
||||||
<Image
|
<Image
|
||||||
src={props.src}
|
src={props.src}
|
||||||
alt={props.alt}
|
alt={props.alt}
|
||||||
|
|||||||
@@ -1,10 +1,13 @@
|
|||||||
.pic {
|
.pic {
|
||||||
/* position: relative; */
|
|
||||||
/* width: calc(100% + var(--kazimir-image-increase)); */
|
|
||||||
/* margin-left: calc(-0.5 * var(--kazimir-image-increase)); */
|
|
||||||
margin-bottom: var(--size-xl);
|
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 {
|
.pic.vertical {
|
||||||
max-width: 60%;
|
max-width: 60%;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ export function createPageTokens(components: StrapiComponent[]): Token[] {
|
|||||||
case 'hudozka.image': {
|
case 'hudozka.image': {
|
||||||
return {
|
return {
|
||||||
token: 'image',
|
token: 'image',
|
||||||
|
wide: component.wide,
|
||||||
data: {
|
data: {
|
||||||
alt: component.caption,
|
alt: component.caption,
|
||||||
caption: component.caption,
|
caption: component.caption,
|
||||||
|
|||||||
+2
-2
@@ -53,7 +53,7 @@
|
|||||||
|
|
||||||
/* KAZIMIR */
|
/* KAZIMIR */
|
||||||
--kazimir-caption-margin: 0px;
|
--kazimir-caption-margin: 0px;
|
||||||
--kazimir-image-increase: 50px;
|
--picture-wide-increase: 100px;
|
||||||
}
|
}
|
||||||
|
|
||||||
* {
|
* {
|
||||||
@@ -183,7 +183,7 @@ a.invisible {
|
|||||||
--content-margin: var(--size-m);
|
--content-margin: var(--size-m);
|
||||||
--content-wide-margin: var(--size-m) var(--size-m);
|
--content-wide-margin: var(--size-m) var(--size-m);
|
||||||
|
|
||||||
--kazimir-image-increase: 0px;
|
--picture-wide-increase: 0px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -113,6 +113,7 @@ export type TextToken = {
|
|||||||
|
|
||||||
export type ImageToken = {
|
export type ImageToken = {
|
||||||
token: 'image'
|
token: 'image'
|
||||||
|
wide: boolean
|
||||||
data: Pic
|
data: Pic
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user