1
0
mirror of https://github.com/barthuijgen/factorio-sites.git synced 2025-03-17 21:17:57 +02:00

Blueprint title fixes

This commit is contained in:
Bart 2021-03-17 21:17:38 +01:00
parent e99a90b383
commit 6d1a979f29
3 changed files with 26 additions and 48 deletions

View File

@ -6,6 +6,7 @@ import clsx from "clsx";
const StyledPanel = styled(Box)`
display: flex;
flex-direction: column;
width: 100%;
padding: 12px;
background-color: #313031;
box-shadow: inset 3px 0 3px -3px #201815, inset 2px 0 2px -2px #201815,
@ -13,16 +14,16 @@ const StyledPanel = styled(Box)`
inset 0 1px 1px -1px #8f8c8b, inset -3px 0 3px -3px #201815, inset -2px 0 2px -2px #201815,
inset -2px 0 1px -1px #201815, inset 0 -3px 3px -3px #000, inset 0 -2px 2px -2px #000,
inset 0 -1px 1px -1px #000, 0 0 2px 0 #201815, 0 0 4px 0 #201815;
`;
.title {
font-weight: 900;
color: #ffe6c0;
line-height: 1.25;
margin: 0 0 12px 0;
font-size: 120%;
display: flex;
align-items: center;
}
const StyledTitle = styled.h2`
font-weight: 900;
color: #ffe6c0;
line-height: 1.25;
margin: 0 0 12px 0;
font-size: 120%;
display: flex;
align-items: center;
`;
const StyledPanelContent = styled.div`
@ -42,8 +43,8 @@ interface PanelProps extends Omit<BoxProps, "title" | "bottom"> {
export const Panel: React.FC<PanelProps> = ({ title, bottom, children, className, ...props }) => (
<StyledPanel className={clsx("panel", className)} {...props}>
{title && <h2 className="title">{title}</h2>}
{title && <StyledTitle className="title">{title}</StyledTitle>}
<StyledPanelContent>{children}</StyledPanelContent>
{bottom && <div className="panel-inset">{bottom}</div>}
{bottom && <div>{bottom}</div>}
</StyledPanel>
);

View File

@ -13,24 +13,16 @@ import { BlueprintData } from "./BlueprintData";
import { BlueprintInfo } from "./BlueprintInfo";
import { BlueprintTags } from "./BlueprintTags";
import { BlueprintEntities } from "./BlueprintEntities";
import { FactorioCode } from "../FactorioCode";
const StyledBlueptintPage = styled(Grid)`
grid-gap: 16px;
.title {
position: relative;
width: 100%;
display: flex;
align-items: center;
.text {
white-space: nowrap;
width: calc(100% - 120px);
display: inline-block;
overflow: hidden;
text-overflow: ellipsis;
}
.text {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
margin-right: 0.5rem;
flex-grow: 1;
}
.panel {
@ -42,10 +34,6 @@ const StyledBlueptintPage = styled(Grid)`
overflow: auto;
}
}
.description {
max-height: 600px;
}
}
`;
@ -89,7 +77,7 @@ export const BlueprintSubPage: React.FC<BlueprintProps> = ({
gridColumn={chakraResponsive({ mobile: "1", desktop: "3 / span 2" })}
gridRow="1"
title={
<div className="title">
<>
<span>Image</span>
<img
src="/fbe.svg"
@ -112,21 +100,20 @@ export const BlueprintSubPage: React.FC<BlueprintProps> = ({
/>
)}
</Box>
</div>
</>
}
>
{string && <ImageEditor string={string}></ImageEditor>}
</Panel>
<Panel
className="description"
gridColumn={chakraResponsive({ mobile: "1", desktop: "1 / span 2" })}
gridRow={chakraResponsive({ mobile: null, desktop: "1" })}
title={
<div className="title">
<>
<span className="text">{blueprint_page.title}</span>
<FavoriteButton is_favorite={favorite} blueprint_page_id={blueprint_page.id} />
</div>
</>
}
>
<StyledMarkdown>{blueprint_page.description_markdown}</StyledMarkdown>

View File

@ -29,12 +29,12 @@ import { FactorioCode } from "../FactorioCode";
const StyledBlueptintPage = styled(Grid)`
grid-gap: 16px;
.title .text {
.text {
white-space: nowrap;
width: calc(100% - 120px);
display: inline-block;
overflow: hidden;
text-overflow: ellipsis;
margin-right: 0.5rem;
flex-grow: 1;
}
.panel {
@ -46,10 +46,6 @@ const StyledBlueptintPage = styled(Grid)`
overflow: auto;
}
}
.description {
max-height: 600px;
}
}
`;
@ -190,15 +186,9 @@ export const BlueprintBookSubPage: React.FC<BlueprintBookSubPageProps> = ({
</Panel>
<Panel
className="description"
title="Description"
gridColumn={chakraResponsive({ mobile: "1", desktop: "1 / span 2" })}
gridRow={chakraResponsive({ mobile: null, desktop: "2 / span 2" })}
title={
<>
<span className="text">Description </span>
<FavoriteButton is_favorite={favorite} blueprint_page_id={blueprint_page.id} />
</>
}
>
<StyledMarkdown>{blueprint_page.description_markdown}</StyledMarkdown>
</Panel>