Skip to content

Commit ebb7f54

Browse files
committed
docs(ui-date-time-input): fix Calendar and DateTimeInput page examples clipped off in docs
This fix makes margins much smaller in small viewports, so pages look much better. This fixes Calendar examples being clipped off INSTUI-4256
1 parent 7427773 commit ebb7f54

File tree

2 files changed

+19
-19
lines changed

2 files changed

+19
-19
lines changed

packages/__docs__/src/App/index.tsx

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ import type {
8181
ParsedDocSummary
8282
} from '../../buildScripts/DataTypes.mjs'
8383
import { logError } from '@instructure/console'
84+
import type { Spacing } from '@instructure/emotion'
8485

8586
type AppContextType = {
8687
themeKey: keyof MainDocsData['themes']
@@ -482,14 +483,7 @@ class App extends Component<AppProps, AppState> {
482483
const themeVariables = themes[themeKey!].resource
483484
const heading = currentData.extension !== '.md' ? currentData.title : ''
484485
const documentContent = (
485-
<View
486-
as="div"
487-
padding={
488-
layout === 'small' || layout === 'medium'
489-
? 'x-large none none large'
490-
: 'x-large none none'
491-
}
492-
>
486+
<View as="div" padding="x-large none none">
493487
{this.renderThemeSelect()}
494488
<View
495489
elementRef={this.mainContentRef}
@@ -511,12 +505,14 @@ class App extends Component<AppProps, AppState> {
511505
</View>
512506
</View>
513507
)
514-
return this.renderWrappedContent(documentContent)
508+
const padding: Spacing =
509+
layout === 'small' ? 'large small large small' : 'large'
510+
return this.renderWrappedContent(documentContent, padding)
515511
}
516512

517513
renderWrappedContent(
518514
content: ReactElement[] | ReactElement,
519-
padding: any = 'large'
515+
padding: Spacing = 'large'
520516
) {
521517
return <ContentWrap padding={padding}>{content}</ContentWrap>
522518
}
@@ -701,7 +697,8 @@ class App extends Component<AppProps, AppState> {
701697
shape="circle"
702698
color="secondary"
703699
size="medium"
704-
aria-expanded={true} />
700+
aria-expanded={true}
701+
/>
705702
</InstUISettingsProvider>
706703
</View>
707704

@@ -824,6 +821,9 @@ class App extends Component<AppProps, AppState> {
824821
<div css={this.props.styles?.hamburger}>
825822
<InstUISettingsProvider>
826823
<IconButton
824+
themeOverride={{
825+
secondaryBorderColor: '#343434'
826+
}}
827827
onClick={this.handleMenuOpen}
828828
elementRef={this.handleMenuTriggerRef}
829829
renderIcon={IconHamburgerSolid}

packages/ui-date-time-input/src/DateTimeInput/README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ The component is localized via its `locale` and `timezone` parameters. Both are
2323
class Example extends React.Component {
2424
render() {
2525
return (
26-
<div style={{ height: '10rem', width: '40em' }}>
26+
<div style={{ height: '15rem' }}>
2727
<DateTimeInput
2828
description="Pick a date and time"
2929
datePlaceholder="Choose a date"
@@ -45,7 +45,7 @@ The component is localized via its `locale` and `timezone` parameters. Both are
4545
- ```js
4646
const Example = () => {
4747
return (
48-
<div style={{ height: '10rem', width: '40em' }}>
48+
<div style={{ height: '15rem' }}>
4949
<DateTimeInput
5050
description="Pick a date and time"
5151
datePlaceholder="Choose a date"
@@ -98,7 +98,7 @@ This sample code also allows the user to enter an arbitrary time value by settin
9898
? new Date(this.state.value).toString()
9999
: 'N/A'
100100
return (
101-
<div style={{ width: '25em' }}>
101+
<div>
102102
<div style={{ marginBottom: '1em', fontStyle: 'italic' }}>
103103
You entered:
104104
<br />
@@ -155,7 +155,7 @@ This sample code also allows the user to enter an arbitrary time value by settin
155155
const text = value ? new Date(value).toString() : 'N/A'
156156

157157
return (
158-
<div style={{ width: '25em' }}>
158+
<div>
159159
<div style={{ marginBottom: '1em', fontStyle: 'italic' }}>
160160
You entered:
161161
<br />
@@ -214,7 +214,7 @@ type: example
214214
render() {
215215
return (
216216
<ApplyLocale locale="fr" timezone="Africa/Nairobi">
217-
<div style={{ height: '12rem', width: '40em' }}>
217+
<div style={{ height: '14rem' }}>
218218
<DateTimeInput
219219
description="Pick a date and time"
220220
datePlaceholder="Choose a date"
@@ -240,7 +240,7 @@ type: example
240240
const Example = () => {
241241
return (
242242
<ApplyLocale locale="fr" timezone="Africa/Nairobi">
243-
<div style={{ height: '12rem', width: '40em' }}>
243+
<div style={{ height: '14rem' }}>
244244
<DateTimeInput
245245
description="Pick a date and time"
246246
datePlaceholder="Choose a date"
@@ -304,7 +304,7 @@ type: example
304304
}
305305
render() {
306306
return (
307-
<div style={{ height: '12rem', width: '40em' }}>
307+
<div style={{ height: '15rem' }}>
308308
<DateTimeInput
309309
description="Pick a date and time"
310310
datePlaceholder="Choose a date"
@@ -349,7 +349,7 @@ type: example
349349
}
350350

351351
return (
352-
<div style={{ height: '12rem', width: '40em' }}>
352+
<div style={{ height: '15rem' }}>
353353
<DateTimeInput
354354
description="Pick a date and time"
355355
datePlaceholder="Choose a date"

0 commit comments

Comments
 (0)