Skip to content

Commit 9342b7c

Browse files
authored
feat: update examples (#495)
* feat: update examples * chore: try to omit examples * fix: golangcilint
1 parent f4e0b2d commit 9342b7c

File tree

5 files changed

+120
-11
lines changed

5 files changed

+120
-11
lines changed

.golangci.yml

+4-3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ run:
22
tests: false
33
issues:
44
exclude-dirs:
5-
- pkg/worker
6-
- cmd/webworker
7-
- web
5+
- pkg/worker
6+
- cmd/webworker
7+
- web
8+
- web/public/examples

web/public/examples/testdata/bad-apple.go

+80
Large diffs are not rendered by default.

web/src/components/layout/Header/Header.tsx

+11-1
Original file line numberDiff line numberDiff line change
@@ -252,10 +252,20 @@ class HeaderContainer extends ThemeableComponent<Props, HeaderState> {
252252
isOpen={showSettings}
253253
/>
254254
<AboutModal
255+
isOpen={showAbout}
255256
onClose={() => {
256257
this.setState({ showAbout: false })
257258
}}
258-
isOpen={showAbout}
259+
onTitleClick={() => {
260+
this.setState({ showAbout: false })
261+
this.onSnippetSelected({
262+
label: 'bad-apple',
263+
source: {
264+
basePath: 'testdata',
265+
files: ['bad-apple.go'],
266+
},
267+
})
268+
}}
259269
/>
260270
<ExamplesModal
261271
isOpen={showExamples}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
@keyframes logoAnimation {
2+
0% {
3+
background-position: 0% 50%;
4+
}
5+
50% {
6+
background-position: 100% 50%;
7+
}
8+
100% {
9+
background-position: 0% 50%;
10+
}
11+
}

web/src/components/modals/AboutModal/AboutModal.tsx

+14-7
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,17 @@ import { getContentStyles, getIconButtonStyles } from '~/styles/modal'
1616
import environment from '~/environment'
1717
import { SponsorsBlock } from './SponsorsBlock'
1818
import { FooterButtons } from './FooterButtons'
19+
import './AboutModal.css'
1920

2021
const TITLE_ID = 'AboutTitle'
2122

2223
interface AboutModalProps {
2324
isOpen?: boolean
2425
onClose: () => void
26+
onTitleClick?: () => void
2527
}
2628

27-
export const AboutModal: React.FC<AboutModalProps> = (props: AboutModalProps) => {
29+
export const AboutModal: React.FC<AboutModalProps> = ({ isOpen, onClose, onTitleClick }) => {
2830
const theme = useTheme()
2931
const contentStyles = getContentStyles(theme)
3032
const iconButtonStyles = getIconButtonStyles(theme)
@@ -42,11 +44,16 @@ export const AboutModal: React.FC<AboutModalProps> = (props: AboutModalProps) =>
4244
title: {
4345
fontWeight: FontWeights.semibold,
4446
fontSize: FontSizes.xxLargePlus,
45-
padding: '1em 0 2em',
47+
margin: '1em 0 2em',
4648
color: 'transparent',
49+
cursor: 'default',
4750
background:
48-
'linear-gradient(to right, rgb(10,97,244) 0%, rgb(16, 187, 187) 100%) repeat scroll 0% 0% / auto padding-box text',
51+
'linear-gradient(to right, #0a61f4, #10bbbb, #10d88a, #6e0af4, #f40a6e, #a4e410, #f45b0a) repeat scroll 0% 0% / auto padding-box text',
52+
backgroundSize: '550% 550%',
4953
textAlign: 'center',
54+
'&:hover': {
55+
animation: 'logoAnimation 30s infinite',
56+
},
5057
},
5158
info: {
5259
display: 'flex',
@@ -67,8 +74,8 @@ export const AboutModal: React.FC<AboutModalProps> = (props: AboutModalProps) =>
6774
return (
6875
<Modal
6976
titleAriaId={TITLE_ID}
70-
isOpen={props.isOpen}
71-
onDismiss={props.onClose}
77+
isOpen={isOpen}
78+
onDismiss={onClose}
7279
styles={modalStyles}
7380
containerClassName={modalStyles.container}
7481
>
@@ -77,11 +84,11 @@ export const AboutModal: React.FC<AboutModalProps> = (props: AboutModalProps) =>
7784
iconProps={{ iconName: 'Cancel' }}
7885
styles={iconButtonStyles}
7986
ariaLabel="Close popup modal"
80-
onClick={props.onClose as any}
87+
onClick={onClose as any}
8188
/>
8289
</div>
8390
<div className={contentStyles.body}>
84-
<div id={TITLE_ID} className={modalStyles.title}>
91+
<div id={TITLE_ID} className={modalStyles.title} onClick={onTitleClick}>
8592
Better Go Playground
8693
</div>
8794
<div className={modalStyles.info}>

0 commit comments

Comments
 (0)