-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #104 from connect-foundation/cocode
Cocode 1차 배포
- Loading branch information
Showing
58 changed files
with
7,782 additions
and
183 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import '@storybook/addon-knobs/register'; | ||
import '@storybook/addon-actions/register'; | ||
import '@storybook/addon-links/register'; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { addDecorator, configure } from '@storybook/react'; | ||
import { withKnobs } from '@storybook/addon-knobs'; | ||
import { ThemeDecorator } from 'stories/decorators/ThemeDecorator'; | ||
|
||
addDecorator(withKnobs); | ||
addDecorator(ThemeDecorator); | ||
configure(require.context('../src', true, /\.stories\.js$/), module); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
const path = require('path'); | ||
|
||
module.exports = async ({ config }) => { | ||
|
||
config.resolve.modules = [ | ||
...(config.resolve.modules || []), | ||
path.resolve(path.join(__dirname), '../src'), | ||
]; | ||
return config; | ||
}; |
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ | |
</head> | ||
<body> | ||
<div id="root"></div> | ||
<div id="modal"></div> | ||
<script src="./bundle.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import React from 'react'; | ||
import backward from './backward.svg'; | ||
|
||
const IMAGE_ALT = 'go backward'; | ||
|
||
function BackwardButton({ className, onClick }) { | ||
return ( | ||
<button className={className} onClick={onClick}> | ||
<img src={backward} alt={IMAGE_ALT} /> | ||
</button> | ||
); | ||
} | ||
|
||
export default BackwardButton; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import React from 'react'; | ||
import forward from './forward.svg'; | ||
|
||
const IMAGE_ALT = 'go forward'; | ||
|
||
function ForwardButton({ className, onClick }) { | ||
return ( | ||
<button className={className} onClick={onClick}> | ||
<img src={forward} alt={IMAGE_ALT} /> | ||
</button> | ||
); | ||
} | ||
|
||
export default ForwardButton; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import React from 'react'; | ||
import reload from './reload.svg'; | ||
|
||
const IMAGE_ALT = 'reload page'; | ||
|
||
function ReloadButton({ className, onClick }) { | ||
return ( | ||
<button className={className} onClick={onClick}> | ||
<img src={reload} alt={IMAGE_ALT} /> | ||
</button> | ||
); | ||
} | ||
|
||
export default ReloadButton; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import React, { useState } from 'react'; | ||
import * as Styled from './style'; | ||
|
||
import BackwardButton from './BackwardButton'; | ||
import ForwardButton from './ForwardButton'; | ||
import ReloadButton from './ReloadButton'; | ||
|
||
import { KEY_CODE_ENTER } from 'constants/keyCode'; | ||
|
||
const DEFAULT_URL = 'http://localhost:3000/'; | ||
|
||
function BrowserHeader({ | ||
onGoBackward, | ||
onGoForward, | ||
onReload, | ||
addressInputURL, | ||
handleAddressInputKeyDown, | ||
theme | ||
}) { | ||
return ( | ||
<Styled.BrowserHeader browserHeaderBGColor={theme.browserHeaderBGColor}> | ||
<BackwardButton | ||
className="BrowserHeader-item" | ||
onClick={onGoBackward} | ||
/> | ||
<ForwardButton | ||
className="BrowserHeader-item" | ||
onClick={onGoForward} | ||
/> | ||
<ReloadButton className="BrowserHeader-item" onClick={onReload} /> | ||
<Styled.AddressInput | ||
className="BrowserHeader-item" | ||
type="url" | ||
aria-label="browserAddress" | ||
defaultValue={addressInputURL} | ||
onKeyUp={handleAddressInputKeyDown} | ||
adressInputBGColor={theme.adressInputBGColor} | ||
adressInputFontColor={theme.adressInputTextColor} | ||
/> | ||
</Styled.BrowserHeader> | ||
); | ||
} | ||
|
||
function Browser({ onGoBackward, onGoForward, onReload, url, theme }) { | ||
const [addressInputURL, setAddressInput] = useState( | ||
url ? url : DEFAULT_URL | ||
); | ||
const [currentURL, setCurrentURL] = useState(url ? url : DEFAULT_URL); | ||
|
||
const handleAddressInputKeyDown = ({ keyCode, target: { value } }) => { | ||
setAddressInput(value); | ||
if (keyCode === KEY_CODE_ENTER) setCurrentURL(value); | ||
}; | ||
|
||
return ( | ||
<Styled.Browser height={theme.browserHeignt}> | ||
<BrowserHeader | ||
onGoBackward={onGoBackward} | ||
onGoForward={onGoForward} | ||
onReload={onReload} | ||
addressInputURL={addressInputURL} | ||
handleAddressInputKeyDown={handleAddressInputKeyDown} | ||
theme={theme} | ||
/> | ||
<Styled.Iframe src={currentURL} /> | ||
</Styled.Browser> | ||
); | ||
} | ||
|
||
export default Browser; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import React from 'react'; | ||
import { text } from '@storybook/addon-knobs'; | ||
|
||
import Browser from '.'; | ||
|
||
export default { | ||
title: 'Browser' | ||
}; | ||
|
||
function BrowserDefault() { | ||
return <Browser url={text('url', 'http://localhost:3000/')} />; | ||
} | ||
|
||
export { BrowserDefault }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import styled from 'styled-components'; | ||
|
||
const Browser = styled.section` | ||
& { | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: stretch; | ||
height: ${({ height }) => height}; | ||
} | ||
`; | ||
|
||
const BrowserHeader = styled.header` | ||
& { | ||
display: flex; | ||
flex-direction: row; | ||
align-items: center; | ||
padding: 0.4rem 0.6rem; | ||
background-color: ${({ browserHeaderBGColor }) => browserHeaderBGColor}; | ||
} | ||
.BrowserHeader-item { | ||
margin: 0 0.5rem; | ||
} | ||
`; | ||
|
||
const AddressInput = styled.input` | ||
& { | ||
flex-grow: 2; | ||
padding: 0.5rem 1rem; | ||
background: ${({ adressInputBGColor }) => adressInputBGColor}; | ||
color: ${({ adressInputTextColor }) => adressInputTextColor}; | ||
font-size: 1rem; | ||
} | ||
`; | ||
|
||
const Iframe = styled.iframe` | ||
& { | ||
flex-grow: 2; | ||
background-color: white; | ||
} | ||
`; | ||
|
||
export { Browser, BrowserHeader, AddressInput, Iframe }; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import React from 'react'; | ||
import close from './close.svg'; | ||
|
||
function CloseButton({ onClick }) { | ||
return ( | ||
<button onClick={onClick}> | ||
<img src={close} /> | ||
</button> | ||
); | ||
} | ||
|
||
export default CloseButton; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import React from 'react'; | ||
import { LinkButton, AButton, Button } from './style'; | ||
|
||
function ExampleButton({ style = {}, to = null, href = null, ...props }) { | ||
if (to) return <LinkButton style={style} {...props} />; | ||
|
||
if (href) return <AButton style={style} {...props} />; | ||
|
||
return <Button style={style} {...props} />; | ||
} | ||
|
||
export { ExampleButton as Button }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import React from 'react'; | ||
|
||
import { action } from '@storybook/addon-actions'; | ||
import { text, boolean } from '@storybook/addon-knobs'; | ||
import { Button } from '.'; | ||
|
||
export default { | ||
title: 'Button' | ||
}; | ||
|
||
function basicButton() { | ||
return <Button onClick={action('onClick')}>{text('Value', 'Text')}</Button>; | ||
} | ||
|
||
function hrefButton() { | ||
return ( | ||
<Button href={text('href', 'https://www.naver.com')}> | ||
{text('Value', 'Text')} | ||
</Button> | ||
); | ||
} | ||
|
||
function redButton() { | ||
return <Button red={boolean('red', true)}>{text('Value', 'Text')}</Button>; | ||
} | ||
|
||
export { basicButton, hrefButton, redButton }; |
Oops, something went wrong.