Skip to content

Commit 72d8678

Browse files
committed
Update demo app
1 parent 60bb87f commit 72d8678

File tree

14 files changed

+84
-77
lines changed

14 files changed

+84
-77
lines changed

demo/package-lock.json

Lines changed: 35 additions & 35 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

demo/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@
1515
"use-dark-mode": "^2.3.1"
1616
},
1717
"devDependencies": {
18-
"@testing-library/jest-dom": "^5.11.10",
18+
"@testing-library/jest-dom": "^5.12.0",
1919
"@testing-library/react": "^11.2.6",
20-
"@testing-library/user-event": "^13.1.1",
21-
"@types/jest": "^26.0.22",
22-
"@types/node": "^14.14.41",
23-
"@types/react": "^17.0.3",
20+
"@testing-library/user-event": "^13.1.8",
21+
"@types/jest": "^26.0.23",
22+
"@types/node": "^15.0.1",
23+
"@types/react": "^17.0.4",
2424
"@types/react-dom": "^17.0.3",
2525
"@types/react-router-dom": "^5.1.7",
2626
"browserslist-config-css-grid": "^1.0.0",

demo/public/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<meta name="viewport" content="width=device-width, initial-scale=1" />
66
<meta
77
name="description"
8-
content="React Interactive, better interactive states than CSS pseudo classes and a callback when the interactive state changes."
8+
content="React Interactive, better hover, active and focus states than CSS pseudo-classes, and a callback when the interactive state changes."
99
/>
1010

1111
<link rel="icon" type=”image/svg+xml” href="%PUBLIC_URL%/favicon/green-grid-144-168-192.svg" />

demo/src/App.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { DemoContainer } from './ui/DemoContainer';
1111

1212
const AppContainer = styled('div', {
1313
maxWidth: '500px',
14-
padding: '10px 15px 25px',
14+
padding: '12px 15px 25px',
1515
margin: '0 auto',
1616
});
1717

@@ -22,16 +22,15 @@ const HeaderContainer = styled('header', {
2222
});
2323

2424
const H1 = styled('h1', {
25-
display: 'flex',
26-
alignItems: 'center',
2725
fontSize: '26px',
28-
marginRight: '10px',
26+
marginRight: '16px',
2927
});
3028

3129
const HeaderIconContainer = styled('span', {
32-
width: '80px',
30+
width: '78px',
3331
display: 'inline-flex',
3432
justifyContent: 'space-between',
33+
gap: '10px',
3534
});
3635

3736
export const App = () => {
@@ -40,11 +39,11 @@ export const App = () => {
4039
<HeaderContainer>
4140
<H1>React Interactive Demo</H1>
4241
<HeaderIconContainer>
42+
<DarkModeButton />
4343
<GitHubIconLink
4444
title="GitHub repository for React Interactive"
4545
href="https://github.com/rafgraph/react-interactive"
4646
/>
47-
<DarkModeButton />
4847
</HeaderIconContainer>
4948
</HeaderContainer>
5049
<DemoContainer as="p" css={{ paddingBottom: '20px' }}>

demo/src/demos/CssStickyHoverBug.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export const CssStickyHoverBug: React.VFC = () => {
6060
<p>
6161
On touch devices the{' '}
6262
<Link href="https://github.com/rafgraph/react-interactive#css-sticky-hover-bug">
63-
CSS <code>:hover</code> state sticks
63+
CSS :hover state sticks
6464
</Link>{' '}
6565
until you tap someplace else on the screen.
6666
</p>

demo/src/demos/FormElements.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,10 @@ const Checkbox = styled(createInteractive(RadixCheckbox.Root), {
9090
border: '1px solid $highContrast',
9191
borderRadius: '2px',
9292

93-
// hover and active styles in LabelBase so styles are applied when label is hovered/active
93+
// hover and active styles in label so styles are applied when label is hovered/active
9494
// '&.hover, &.active': {...},
9595
'&.focusFromKey': {
96-
// !important required so hover and active styles from Label are not applied
96+
// !important required so hover and active styles from label are not applied
9797
// to border and boxShadow when in the focusFromKey state
9898
borderColor: '$purple !important',
9999
boxShadow:

demo/src/demos/ShowOn.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ const InteractiveInfo = styled(Interactive.Span, {
3535
height: 30,
3636
display: 'inline-block',
3737
verticalAlign: 'top',
38+
// outline: 'none' required because this is a span (with tabIndex)
39+
// which doesn't have "unset: all" in css reset applied
3840
outline: 'none',
3941
borderRadius: '50%',
4042
'&.hover': {

demo/src/demos/StateLog.tsx

Lines changed: 19 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import {
44
Interactive,
55
createInteractive,
66
eventFrom,
7-
InteractiveExtendableProps,
87
InteractiveState,
98
InteractiveStateChange,
109
} from 'react-interactive';
@@ -14,25 +13,8 @@ import { CheckIcon } from '@radix-ui/react-icons';
1413
import { DemoContainer, DemoHeading } from '../ui/DemoContainer';
1514
import { styled } from '../stitches.config';
1615

17-
const StateLogContainer = styled('div', {
18-
height: '200px',
19-
padding: '0 5px',
20-
border: '1px solid $highContrast',
21-
overflowY: 'scroll',
22-
fontFamily: 'monospace',
23-
outline: 'none',
24-
'&.focusFromKey': {
25-
outline: '3px solid $colors$purple',
26-
outlineOffset: '1px',
27-
},
28-
});
29-
30-
const InteractiveButton: React.VFC<InteractiveExtendableProps<'button'>> = (
31-
props,
32-
) => <Interactive {...props} as="button" />;
33-
34-
const DemoButton = styled(InteractiveButton, {
35-
fontFamily: 'monospace',
16+
const DemoButton = styled(Interactive.Button, {
17+
fontFamily: '$mono',
3618
fontSize: '20px',
3719
textAlign: 'center',
3820
width: '100%',
@@ -65,6 +47,21 @@ const DemoButton = styled(InteractiveButton, {
6547
},
6648
});
6749

50+
const StateLogContainer = styled('div', {
51+
height: '200px',
52+
padding: '0 5px',
53+
border: '1px solid $highContrast',
54+
overflowY: 'scroll',
55+
fontFamily: '$mono',
56+
// outline: 'none' required because this is a div (with tabIndex)
57+
// which doesn't have "unset: all" in css reset applied
58+
outline: 'none',
59+
'&.focusFromKey': {
60+
outline: '3px solid $colors$purple',
61+
outlineOffset: '1px',
62+
},
63+
});
64+
6865
const variantLookup: Record<string, any> = {
6966
'hover: true': 'green',
7067
'hover: false': 'normal',
@@ -136,11 +133,10 @@ const ExtendedTouchActiveOptionCheckbox = styled(
136133
width: '32px',
137134
height: '32px',
138135
borderRadius: '2px',
139-
// hover and active are styled in LabelBase so styles are applied when label is hovered/active
136+
// hover and active are styled in label so styles are applied when label is hovered/active
140137
// '&.hover, &.active': {...},
141138
'&.focusFromKey': {
142-
outline: 'none',
143-
// !important required so hover and active styles from Label are not applied
139+
// !important required so hover and active styles from label are not applied
144140
// to border and boxShadow when in the focusFromKey state
145141
borderColor: '$purple !important',
146142
boxShadow: '0 0 0 1px $colors$purple !important',

demo/src/demos/StressTest.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ const ShowStressTestButton = styled(Interactive.Button, {
4747
const StressTestItem = styled(Interactive.Button, {
4848
display: 'block',
4949
width: '100%',
50-
fontFamily: 'monospace',
50+
fontFamily: '$mono',
5151
'&.hover, &.mouseActive': {
5252
color: '$green',
5353
},

demo/src/stitches.config.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ export const stitchesConfig = createCss({
1818
purple: 'hsl(270,100%,60%)',
1919
backgroundPurple: 'hsl(270,100%,92%)',
2020
},
21+
fonts: {
22+
mono: 'monospace',
23+
},
2124
},
2225
});
2326

@@ -83,8 +86,7 @@ export const globalCss = createGlobalCss({
8386
textSizeAdjust: 'none',
8487
},
8588
code: {
86-
fontFamily: 'monospace',
87-
lineHeight: '16px',
89+
fontFamily: '$mono',
8890
},
8991
// pass down height: 100% to the #root div
9092
'body, html': {

0 commit comments

Comments
 (0)