1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-24 20:36:40 +07:00

fixed cell text on flow

This commit is contained in:
Fedor Katurov 2021-10-08 11:33:01 +07:00
parent 17e3f211ef
commit 4930be5acf
5 changed files with 42 additions and 22 deletions

View file

@ -14,8 +14,4 @@
height: 10px; height: 10px;
background-color: blue; background-color: blue;
} }
@include tablet {
opacity: 0.7;
}
} }

View file

@ -22,7 +22,7 @@ const FlowCell: FC<Props> = ({ color, to, image, display = 'single', text, title
return ( return (
<NavLink className={classNames(styles.cell, styles[display || 'single'])} to={to}> <NavLink className={classNames(styles.cell, styles[display || 'single'])} to={to}>
{withText && ( {withText && (
<FlowCellText className={styles.text} title={title}> <FlowCellText className={styles.text} heading={<h4 className={styles.title}>{title}</h4>}>
{text!} {text!}
</FlowCellText> </FlowCellText>
)} )}
@ -37,7 +37,12 @@ const FlowCell: FC<Props> = ({ color, to, image, display = 'single', text, title
)} )}
<CellShade color={color} className={styles.shade} size={withText ? 15 : 50} /> <CellShade color={color} className={styles.shade} size={withText ? 15 : 50} />
{!withText && <h4 className={styles.title}>{title}</h4>}
{!withText && (
<div className={styles.title_wrapper}>
<h4 className={styles.title}>{title}</h4>
</div>
)}
</NavLink> </NavLink>
); );
}; };

View file

@ -32,6 +32,7 @@
.shade { .shade {
@include outer_shadow; @include outer_shadow;
position: absolute; position: absolute;
top: 0; top: 0;
left: 0; left: 0;
@ -42,15 +43,26 @@
.text { .text {
position: absolute; position: absolute;
bottom: 10px; bottom: 5px;
left: 10px; left: 5px;
z-index: 1; z-index: 1;
overflow: hidden; overflow: hidden;
border-radius: $radius; border-radius: $radius;
max-height: calc(100% - 20px); max-height: calc(100% - 10px);
max-width: calc(100% - 20px); max-width: calc(100% - 10px);
box-sizing: border-box; box-sizing: border-box;
font: $font_16_regular;
@include tablet {
font: $font_14_regular;
left: 5px;
bottom: 5px;
}
& :global(.grey) {
color: inherit;
opacity: 0.5;
}
.quadro &, .quadro &,
.horizontal & { .horizontal & {
@ -65,13 +77,21 @@
} }
} }
.title { .title_wrapper {
font: $font_cell_title;
position: absolute;
bottom: 0; bottom: 0;
left: 0; left: 0;
width: 100%; width: 100%;
z-index: 10; z-index: 10;
padding: $gap; padding: $gap;
text-transform: uppercase; position: absolute;
}
.title {
font: $font_cell_title;
text-transform: uppercase;
word-break: break-word;
@include tablet {
font: $font_18_semibold;
}
} }

View file

@ -1,4 +1,4 @@
import React, { FC } from 'react'; import React, { FC, ReactElement } from 'react';
import { Markdown } from '~/components/containers/Markdown'; import { Markdown } from '~/components/containers/Markdown';
import { DivProps } from '~/utils/types'; import { DivProps } from '~/utils/types';
import classNames from 'classnames'; import classNames from 'classnames';
@ -7,12 +7,12 @@ import { formatText } from '~/utils/dom';
interface Props extends DivProps { interface Props extends DivProps {
children: string; children: string;
title: string; heading: string | ReactElement;
} }
const FlowCellText: FC<Props> = ({ children, title, ...rest }) => ( const FlowCellText: FC<Props> = ({ children, heading, ...rest }) => (
<div {...rest} className={classNames(styles.text, rest.className)}> <div {...rest} className={classNames(styles.text, rest.className)}>
{title && <h4 className={styles.title}>{title}</h4>} {heading && <div className={styles.heading}>{heading}</div>}
<Markdown <Markdown
className={styles.description} className={styles.description}
dangerouslySetInnerHTML={{ __html: formatText(children) }} dangerouslySetInnerHTML={{ __html: formatText(children) }}

View file

@ -5,8 +5,7 @@
line-height: 1.3em; line-height: 1.3em;
} }
.title { .heading {
font: $font_cell_title; margin-bottom: 0.4em;
margin-bottom: $gap;
text-transform: uppercase;
} }