Skip to content

Commit d4968ad

Browse files
authored
fix(website): wrap keys and values on configuration pages (#4055)
1 parent e8c79f9 commit d4968ad

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

packages/gatsby/src/components/syntax.tsx

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import styled, {StyledComponent} from '@emotion/styled';
33
import {FaLink} from 'react-icons/fa';
44
import React, {PropsWithChildren, useContext} from 'react';
55

6+
import {ifMobile} from './responsive';
7+
68
export type Theme = {
79
name: string;
810

@@ -82,6 +84,7 @@ export const Main = styled.div`
8284
8385
font-family: "Open Sans", sans-serif;
8486
white-space: normal;
87+
overflow-wrap: break-word;
8588
8689
& + * {
8790
margin-top: 0 !important;
@@ -131,19 +134,27 @@ const DescriptionAnchor = styled.div<ThemeProps>`
131134
const DescriptionContainer = styled.div`
132135
padding: 1em;
133136
137+
${ifMobile} {
138+
padding: 1em 0;
139+
}
140+
134141
&:first-of-type {
135142
margin-top: 0;
136143
}
137144
138145
& + div {
139146
margin-top: -0.5em;
140147
}
148+
149+
span {
150+
white-space: normal;
151+
overflow-wrap: break-word;
152+
}
141153
`;
142154

143155
const AnchorContainer = styled.a`
144-
margin-left: -15px;
145-
146-
padding: 15px;
156+
margin-left: -0.5em;
157+
padding: 0.5em;
147158
148159
color: inherit;
149160
text-decoration: none;
@@ -154,6 +165,7 @@ const Description = styled.div`
154165
155166
font-family: "Open Sans", sans-serif;
156167
white-space: normal;
168+
overflow-wrap: break-word;
157169
`;
158170

159171
const NestedSectionHeaderContext = React.createContext(1);
@@ -182,17 +194,17 @@ const Describe = ({theme, name, description, anchor, children}: PropsWithChildre
182194
<DescriptionAnchor id={`${anchor}`} theme={theme}>
183195
<NestedSectionHeader name={name}>
184196
<DescriptionContainer theme={theme}>
185-
{<Description theme={theme}>
197+
<Description theme={theme}>
186198
{description}
187-
</Description>}
199+
</Description>
188200
{children}
189201
</DescriptionContainer>
190202
</NestedSectionHeader>
191203
</DescriptionAnchor>
192204
</> : children as JSX.Element;
193205

194206
const Anchor = () => <>
195-
<span style={{fontSize: `0.7em`}}>
207+
<span style={{fontSize: `0.7em`, whiteSpace: `nowrap`}}>
196208
<FaLink/>
197209
</span>
198210
</>;
@@ -283,7 +295,7 @@ export type ScalarPropertyProps = DescribeProps & ScalarProps;
283295

284296
export const ScalarProperty = ({theme, name, anchor = name, placeholder, description}: ScalarPropertyProps) => <>
285297
<Describe theme={theme} name={name} description={description} anchor={description ? anchor : null}>
286-
<div>
298+
<div style={{marginRight: `-2vw`}}>
287299
<Key theme={theme} name={name} anchorTarget={description ? anchor : null} /><span style={{color: getColorForScalar(theme, placeholder) ?? undefined}}>{theme.formatValue(placeholder)}</span>{theme.dictionaries.suffix}
288300
</div>
289301
</Describe>

0 commit comments

Comments
 (0)