Skip to content

Commit

Permalink
feat: mobile site (#36)
Browse files Browse the repository at this point in the history
* build(yarn): add react-responsive

* feat: use different app components for different screen sizes

* style(fonts): add new source code pro font

* build(yarn): add arwes packages

* style(theme): add new elements to the theme

* style: refactored the theme to use the arwes (emotion) methods

* refactor: move cv version to constants

* refactor: use shorthand imports

* style: add new grey colour

* feat: add new mobile site with links and new UI

* refactor: updates version command to use a normal ts file

* style: make pretty on smaller screens
  • Loading branch information
Kieran O'Neill authored Sep 15, 2021
1 parent 797db47 commit 199854d
Show file tree
Hide file tree
Showing 34 changed files with 643 additions and 136 deletions.
10 changes: 10 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,20 @@
"test": "cross-env NODE_ENV=test jest"
},
"dependencies": {
"@arwes/animation": "^1.0.0-alpha.19",
"@arwes/core": "^1.0.0-alpha.19",
"@arwes/design": "^1.0.0-alpha.19",
"@arwes/sounds": "^1.0.0-alpha.19",
"@emotion/css": "^11.1.3",
"@emotion/react": "^11.4.1",
"@kieranroneill/terminal-in-react": "^4.3.7",
"animejs": "^3.2.1",
"howler": "^2.2.3",
"polished": "^4.1.3",
"react": "^17.0.2",
"react-dom": "^16.13.1",
"react-helmet": "^6.1.0",
"react-responsive": "^9.0.0-beta.4",
"styled-components": "^5.1.1"
},
"devDependencies": {
Expand Down
3 changes: 3 additions & 0 deletions src/@types/fonts/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
declare module '*.ttf';
declare module '*.woff';
declare module '*.woff2';
9 changes: 4 additions & 5 deletions src/commands/cv.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Command } from '@kieranroneill/terminal-in-react';

// Constants.
import { Descriptions, Files, Paths } from '../constants';
import { Descriptions, Files, Paths, Versions } from '../constants';

// Descriptions.
import { cvDescription } from '../descriptions';
Expand All @@ -21,7 +21,6 @@ Mandatory arguments to long options are mandatory for short options too.
-h, --help ${Descriptions.HELP_OPTION}
-v, --version ${Descriptions.VERSION_OPTION}
`;
const version: string = 'v9.0.0';

return {
method: (args, print) => {
Expand All @@ -32,21 +31,21 @@ Mandatory arguments to long options are mandatory for short options too.
}

if (args.v || args.v) {
print(version);
print(Versions.CV);

return;
}

if (args.d || args.download) {
downloadFile(Paths.DOCS, Files.CV.replace('${version}', version));
downloadFile(Paths.DOCS, Files.CV.replace('${version}', Versions.CV));

print('You have downloaded my CV, prepare to be entertained!');

return;
}

window.open(
`${Paths.DOCS}/${Files.CV.replace('${version}', version)}`,
`${Paths.DOCS}/${Files.CV.replace('${version}', Versions.CV)}`,
'_blank'
);

Expand Down
1 change: 0 additions & 1 deletion src/commands/version.tsx → src/commands/version.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Command } from '@kieranroneill/terminal-in-react';
import React from 'react';

// Constants.
import { Descriptions } from '../constants';
Expand Down
94 changes: 9 additions & 85 deletions src/components/App/App.tsx
Original file line number Diff line number Diff line change
@@ -1,99 +1,23 @@
import Terminal from '@kieranroneill/terminal-in-react';
import React, { useState } from 'react';
import styled from 'styled-components';
import React from 'react';
import { useMediaQuery } from 'react-responsive';

// Commands.
import {
getAsteroidsCmd,
getBarrelRollCmd,
getCVCmd,
getGithubCmd,
getLinkedInCmd,
getTwitterCmd,
getVersion,
} from '../../commands';

// Components.
import AsteroidsGame from '../AsteroidsGame';
import BarrelRoll from '../BarrelRoll';
// Components
import DesktopApp from './DesktopApp';
import GlobalStyle from '../GlobalStyle';
import Helmet from '../Helmet';
import MobileOrTabletApp from './MobileOrTabletApp';

// Descriptions.
import {
asteroidsDescription,
barrelrollDescription,
cvDescription,
githubDescription,
linkedinDescription,
twitterDescription,
versionDescription,
} from '../../descriptions';

const WrapComponent = styled.div`
display: flex;
flex-direction: row;
height: 100vh;
`;
// Theme
import { minSizes } from '../../theme';

const App: React.FC = () => {
const [asteroidsOpen, setAsteroidsOpen] = useState<boolean>(false);
const [barrelRolling, setBarrelRolling] = useState<boolean>(false);
const msg: string = `
Welcome to
__ _ _ ____
/ /__(_)__ _________ _____ ____ ____ ___ (_) / /_________ ____ ___
/ // / / _ \\/ ___/ __ \`/ __ \\/ __ \\/ __ \\/ _ \\/ / / // ___/ __ \\/ __ \`__ \\
/ , </ / __/ / / /_/ / / / / /_/ / / / / __/ / / // /__/ /_/ / / / / / /
/_/|_/_/\\___/_/ \\__,_/_/ /_/\\____/_/ /_/\\___/_/_/_(_)___/\\____/_/ /_/ /_/
Type \`help\` to begin'
`;
const isDesktopOrLaptop = useMediaQuery({ minWidth: minSizes.desktop });

return (
<>
<GlobalStyle />
<Helmet />
{asteroidsOpen && (
<AsteroidsGame onClose={() => setAsteroidsOpen(false)} />
)}
<BarrelRoll
onComplete={() => setBarrelRolling(false)}
roll={barrelRolling}
/>
<WrapComponent>
<Terminal
allowTabs={false}
backgroundColor="black"
color="green"
commands={{
asteroids: getAsteroidsCmd(setAsteroidsOpen),
barrelroll: getBarrelRollCmd(setBarrelRolling),
cv: getCVCmd(),
github: getGithubCmd(),
linkedin: getLinkedInCmd(),
twitter: getTwitterCmd(),
version: getVersion(),
}}
descriptions={{
asteroids: asteroidsDescription,
barrelroll: barrelrollDescription,
cv: cvDescription,
github: githubDescription,
linkedin: linkedinDescription,
twitter: twitterDescription,
version: versionDescription,
}}
hideTopBar={true}
msg={msg}
promptSymbol="$ "
showActions={false}
startState="maximised"
style={{
display: asteroidsOpen ? 'none' : 'block',
}}
/>
</WrapComponent>
{isDesktopOrLaptop ? <DesktopApp /> : <MobileOrTabletApp />}
</>
);
};
Expand Down
100 changes: 100 additions & 0 deletions src/components/App/DesktopApp.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
import Terminal from '@kieranroneill/terminal-in-react';
import React, { useState } from 'react';
import styled from 'styled-components';

// Commands
import {
getAsteroidsCmd,
getBarrelRollCmd,
getCVCmd,
getGithubCmd,
getLinkedInCmd,
getTwitterCmd,
getVersion,
} from '../../commands';

// Components
import AsteroidsGame from '../AsteroidsGame';
import BarrelRoll from '../BarrelRoll';

// Descriptions
import {
asteroidsDescription,
barrelrollDescription,
cvDescription,
githubDescription,
linkedinDescription,
twitterDescription,
versionDescription,
} from '../../descriptions';

// Theme
import { palette } from '../../theme';

const WrapComponent = styled.div`
display: flex;
flex-direction: row;
height: 100vh;
`;

const DesktopApp: React.FC = () => {
const [asteroidsOpen, setAsteroidsOpen] = useState<boolean>(false);
const [barrelRolling, setBarrelRolling] = useState<boolean>(false);
const msg: string = `
Welcome to
__ _ _ ____
/ /__(_)__ _________ _____ ____ ____ ___ (_) / /_________ ____ ___
/ // / / _ \\/ ___/ __ \`/ __ \\/ __ \\/ __ \\/ _ \\/ / / // ___/ __ \\/ __ \`__ \\
/ , </ / __/ / / /_/ / / / / /_/ / / / / __/ / / // /__/ /_/ / / / / / /
/_/|_/_/\\___/_/ \\__,_/_/ /_/\\____/_/ /_/\\___/_/_/_(_)___/\\____/_/ /_/ /_/
Type \`help\` to begin'
`;

return (
<>
{asteroidsOpen && (
<AsteroidsGame onClose={() => setAsteroidsOpen(false)} />
)}
<BarrelRoll
onComplete={() => setBarrelRolling(false)}
roll={barrelRolling}
/>
<WrapComponent>
<Terminal
allowTabs={false}
backgroundColor="black"
color={palette.brand.primary.main}
commands={{
asteroids: getAsteroidsCmd(setAsteroidsOpen),
barrelroll: getBarrelRollCmd(setBarrelRolling),
cv: getCVCmd(),
github: getGithubCmd(),
linkedin: getLinkedInCmd(),
twitter: getTwitterCmd(),
version: getVersion(),
}}
descriptions={{
asteroids: asteroidsDescription,
barrelroll: barrelrollDescription,
cv: cvDescription,
github: githubDescription,
linkedin: linkedinDescription,
twitter: twitterDescription,
version: versionDescription,
}}
hideTopBar={true}
msg={msg}
promptSymbol="$ "
showActions={false}
startState="maximised"
style={{
display: asteroidsOpen ? 'none' : 'block',
}}
/>
</WrapComponent>
</>
);
};

export default DesktopApp;
Loading

0 comments on commit 199854d

Please sign in to comment.