Skip to content
This repository was archived by the owner on Mar 4, 2020. It is now read-only.

docs: Removing Semantic UI from Stardust- DocSite #679

Merged
merged 81 commits into from
Feb 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
17f9942
(Docs)Updating to stardust from Semantic UI
Sep 18, 2018
3ce7d9d
Docs(Site): moving to stardust
Sep 20, 2018
50ffd7f
Doc(Site): attempting styling
Sep 20, 2018
f090aec
Docs(Site): further improvements
Sep 21, 2018
0935b3e
Fixing merge
Dec 7, 2018
cb72d70
Fixing component buttons
Dec 7, 2018
2d19590
Merge branch 'master' of https://github.com/stardust-ui/react into hu…
Dec 10, 2018
6ce3d9b
Improving slowly
Dec 11, 2018
64279a8
Almost removing semantic ;)
Dec 11, 2018
736b1da
Removing last semantic UI includes ;)
Dec 12, 2018
b6314c8
Removing semantic-ui
Dec 12, 2018
3afc907
Merge branch 'master' of https://github.com/stardust-ui/react into hu…
Dec 12, 2018
542c8f0
Working without SemanticUI ;)
Dec 12, 2018
409fd28
Styling sidebar a bit
Dec 12, 2018
447ba22
Minor updates
Dec 13, 2018
020ffa4
Improving sidebar
Dec 19, 2018
35fcf64
UI Improvements
Dec 19, 2018
39b5c2a
Fixing themes varaible editing
Dec 20, 2018
6276f73
Merging master
Dec 20, 2018
7476350
Adding accessibility descriptions back
Dec 20, 2018
414afb7
Fixing build
Dec 20, 2018
6d73f8c
Attempting to fix more styling
Dec 20, 2018
39629af
Merge branch 'master' of https://github.com/stardust-ui/react into hu…
Dec 21, 2018
772b254
component toolbar
Dec 21, 2018
97c7213
add missing lodash import, add keys
Dec 21, 2018
459bf3c
Minor fixes
Dec 21, 2018
b0cf5fe
Merge branch 'hueland/stardustDocSite' of https://github.com/stardust…
Dec 21, 2018
80598d1
Merge branch 'master' of https://github.com/stardust-ui/react into hu…
Jan 2, 2019
95ec544
Fixing some colors
Jan 2, 2019
ccd0ba6
Updating to latest master
Jan 3, 2019
1d534cc
Accessibility fixes
Jan 3, 2019
783e83e
Attempting toggle with input checkbox
Jan 3, 2019
b3bf43d
Cleaning up changes
Jan 3, 2019
6b841d6
Fixing styling and improving UI
Jan 4, 2019
11ce27a
Improving props UI
Jan 4, 2019
3d226c5
Attempting to fix more usage of style rather than styles prop
Jan 4, 2019
edfda3e
Cleaning up console dom related errors
Jan 4, 2019
a35584f
Merge branch 'master' of https://github.com/stardust-ui/react into hu…
Jan 4, 2019
0e7ab77
Updating to latest and fixing more style= props
Jan 4, 2019
5a86912
Adding dropdown
Jan 10, 2019
e76d52f
Merging from master
Jan 10, 2019
c7be1ac
latest
Jan 15, 2019
c53ba03
merging master
Jan 22, 2019
7774fcd
fixing the NavLink usage that was breaking the component page renreding
Jan 22, 2019
7219dd0
updating the styles for the docs theme Grid
Jan 23, 2019
e3e1a48
Merge branch 'master' into hueland/stardustDocSite
Jan 23, 2019
4a4e11c
using stardust Header in Shorthand Props doc page
Jan 23, 2019
ec1e84a
arranging the elements in the component doc by replacing the Segment …
Jan 25, 2019
318d72f
merging master
Jan 28, 2019
9eab72d
fixing font sizes, updating sidebar and guides layouting
Jan 28, 2019
6ae8d84
Merge branch 'master' into hueland/stardustDocSite
Jan 28, 2019
33e7e05
merge
Feb 4, 2019
57cae72
fixing dependencies
Feb 5, 2019
aa86139
merging
Feb 5, 2019
f013d0c
updating the styles for the inner menu of the component example, enab…
Feb 11, 2019
5d256f0
merging master
Feb 11, 2019
d28451d
merging master
Feb 12, 2019
a7de26a
using Flex component for the component doc
Feb 12, 2019
d527d5a
merging master
Feb 13, 2019
240b9a1
updating the docs to use Flex component instead of Box one
Feb 13, 2019
cb4c1ed
-fixed maximize button
Feb 13, 2019
f529a5b
reverting unneeded changes in teams themes
Feb 13, 2019
6baa671
updating the font awesome usage to fix the component examples
Feb 13, 2019
0f9b4f9
merging
Feb 14, 2019
21f5f62
updating htmlFontSize and bodyFontSize
Feb 14, 2019
5e79802
update the styling individually for :hover and :focus variations
Feb 14, 2019
c922a00
-added border-sizing: border-box on each element via the normalizeCSS
Feb 14, 2019
ccb38cd
-reverted changes for box-sizing
Feb 14, 2019
02ef994
merging msater
Feb 15, 2019
353392e
addressing comments
Feb 15, 2019
efcf39b
Merge branch 'hueland/stardustDocSite' of https://github.com/stardust…
Feb 15, 2019
42ae03b
-fixed theme switcher
Feb 15, 2019
4789b96
mergin master
Feb 15, 2019
219babf
Merge branch 'master' into hueland/stardustDocSite
Feb 15, 2019
c15adb5
enable theming apply on component examples
Feb 15, 2019
16cacb9
Merge branch 'master' into hueland/stardustDocSite
alinais Feb 15, 2019
73b806a
removing unneeded code
Feb 15, 2019
535c749
accessibility improvements for docsite
Feb 18, 2019
84218f6
Merge branch 'master' into hueland/stardustDocSite
alinais Feb 18, 2019
fd41e02
Merge branch 'master' into hueland/stardustDocSite
alinais Feb 18, 2019
2c3b82f
Merge branch 'master' into hueland/stardustDocSite
alinais Feb 18, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 18 additions & 7 deletions docs/src/app.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as React from 'react'
import * as _ from 'lodash'
import { Provider, themes } from '@stardust-ui/react'

import { mergeThemes } from 'src/lib'
Expand All @@ -7,7 +8,7 @@ import Router from './routes'

interface AppState {
themeName: string
changeTheme: (newTheme: string) => void
changeTheme: (event, data) => void
}

class App extends React.Component<any, AppState> {
Expand All @@ -16,9 +17,10 @@ class App extends React.Component<any, AppState> {
constructor(props) {
super(props)

this.changeTheme = newTheme => {
this.changeTheme = (event, data) => {
const themeName = _.camelCase(data.value)
this.setState({
themeName: newTheme,
themeName,
})
}

Expand All @@ -37,10 +39,19 @@ class App extends React.Component<any, AppState> {
<Provider
theme={mergeThemes(themes[themeName], {
// adjust Teams' theme to Semantic UI's font size scheme
siteVariables: {
htmlFontSize: '14px',
bodyFontSize: '1rem',
},
staticStyles: [
{
a: {
textDecoration: 'none',
},
html: {
fontSize: '14px',
},
body: {
fontSize: '1rem',
},
},
],
})}
>
<Router />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { createComponent, Icon, Text, ICSSInJSStyle } from '@stardust-ui/react'
import * as React from 'react'

interface LabelledButtonProps {
iconName: string
label: string
active: boolean
onClick?: (event: React.SyntheticEvent) => void
}

const centered: ICSSInJSStyle = {
textAlign: 'center',
}

const LabelledButton: React.SFC<LabelledButtonProps> = createComponent<LabelledButtonProps>({
displayName: 'LabelledButton',
render: ({ stardust, ...props }) => {
const { iconName, label, active, onClick } = props
return (
<div style={centered} onClick={onClick}>
<Icon
name={iconName}
styles={{ color: active ? 'green' : 'grey', marginBottom: '10px', border: 0 }}
/>
<br />
<Text content={label} styles={{ color: active ? 'green' : 'grey' }} />
</div>
)
},
})
export default LabelledButton
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import * as React from 'react'
import { Menu } from 'semantic-ui-react'
import { Menu, toolbarBehavior, toolbarButtonBehavior } from '@stardust-ui/react'
import { NavLink } from 'react-router-dom'
import * as _ from 'lodash'

import { updateForKeys } from 'docs/src/hoc'
import ComponentButton from './ComponentButton'
import { ComponentSourceManagerLanguage } from 'docs/src/components/ComponentDoc/ComponentSourceManager'
import ComponentControlsCodeSandbox from './ComponentControlsCodeSandbox/ComponentControlsCodeSandbox'
import ComponentControlsShowCode from './ComponentControlsShowCode'
Expand All @@ -17,6 +20,7 @@ type ComponentControlsProps = {
examplePath: string
anchorName: string
onCopyLink: () => void
onMaximize: () => void
onShowCode: () => void
onShowRtl: () => void
onShowTransparent: () => void
Expand All @@ -43,22 +47,76 @@ const ComponentControls: React.FC<ComponentControlsProps> = props => {
onShowRtl,
onShowTransparent,
onShowVariables,
onMaximize,
} = props

return (
<Menu color="green" icon="labeled" size="tiny" compact text>
<ComponentControlsShowCode active={showCode} onClick={onShowCode} />
<ComponentControlsCodeSandbox
exampleCode={exampleCode}
exampleLanguage={exampleLanguage}
exampleName={examplePath}
/>
<ComponentControlsShowVariables active={showVariables} onClick={onShowVariables} />
<ComponentControlsShowTransparent active={showTransparent} onClick={onShowTransparent} />
<ComponentControlsRtl active={showRtl} onClick={onShowRtl} />
<ComponentControlsMaximize examplePath={examplePath} rtl={showRtl} />
<ComponentControlsCopyLink anchorName={anchorName} onClick={onCopyLink} />
</Menu>
<Menu
fluid
color="green"
icon="labeled"
size="tiny"
pills
accessibility={toolbarBehavior}
items={[
{
key: 'show-code',
content: <ComponentControlsShowCode active={showCode} />,
onClick: onShowCode,
accessibility: toolbarButtonBehavior,
},
{
key: 'show-codesandbox',
content: (
<ComponentControlsCodeSandbox
exampleCode={exampleCode}
exampleLanguage={exampleLanguage}
exampleName={examplePath}
/>
),
accessibility: toolbarButtonBehavior,
},
{
key: 'show-variables',
content: <ComponentControlsShowVariables active={showVariables} />,
onClick: onShowVariables,
accessibility: toolbarButtonBehavior,
},
{
key: 'show-transparent',
content: <ComponentControlsShowTransparent active={showTransparent} />,
onClick: onShowTransparent,
accessibility: toolbarButtonBehavior,
},
{
key: 'show-rtl',
content: <ComponentControlsRtl active={showRtl} />,
onClick: onShowRtl,
accessibility: toolbarButtonBehavior,
},
{
key: 'maximize',
content: <ComponentControlsMaximize />,
as: NavLink,
to: `/maximize/${_.kebabCase(
examplePath
.split('/')
.slice(-1)
.pop(),
)}/${showRtl}`,
target: '_blank',
rel: 'noopener noreferrer',
onClick: onMaximize,
accessibility: toolbarButtonBehavior,
},
{
key: 'copy-link',
content: <ComponentControlsCopyLink anchorName={anchorName} />,
onClick: onCopyLink,
accessibility: toolbarButtonBehavior,
},
]}
/>
)
}

Expand All @@ -70,4 +128,4 @@ export default updateForKeys([
'showTransparent',
'showVariables',
'visible',
])(ComponentControls)
])(ComponentControls, ComponentButton)
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@ import * as _ from 'lodash'
import * as React from 'react'
import CodeSandboxer from 'react-codesandboxer'

import { Menu } from 'semantic-ui-react'
import { ComponentSourceManagerLanguage } from 'docs/src/components/ComponentDoc/ComponentSourceManager'
import { imports } from 'docs/src/components/Playground/renderConfig'
import { updateForKeys } from 'docs/src/hoc'
import { appTemplateJs } from './indexTemplates'
import LabelledButton from '../ComponentButton'

type ComponentControlsCodeSandboxProps = {
exampleCode: string
exampleLanguage: ComponentSourceManagerLanguage
exampleName: string
active: boolean
}

type ComponentControlsCodeSandboxState = {
Expand Down Expand Up @@ -44,30 +45,27 @@ class ComponentControlsShowCode extends React.Component<
this.setState({ sandboxUrl })
}

handleClick = e => {
const { sandboxUrl } = this.state
e.preventDefault()
window.open(sandboxUrl)
}

render() {
const { exampleLanguage, exampleCode, exampleName } = this.props
const { active, exampleLanguage, exampleCode, exampleName } = this.props
const { sandboxUrl } = this.state

if (exampleLanguage === 'ts') {
return (
<Menu.Item
disabled
content="CodeSandbox"
icon="connectdevelop"
title="Export of TypeScript code is not supported"
/>
)
return <LabelledButton label="CodeSandbox" iconName="connectdevelop" active={active} />
}

if (sandboxUrl) {
return (
<Menu.Item
as="a"
content="Click to open"
href={sandboxUrl}
icon={{ color: 'green', name: 'checkmark' }}
target="_blank"
title="Open in a new tab"
<LabelledButton
label="Click to open"
onClick={this.handleClick}
iconName="checkmark"
active={active}
/>
)
}
Expand All @@ -87,18 +85,13 @@ class ComponentControlsShowCode extends React.Component<
skipRedirect
template="create-react-app"
>
{({ isLoading, isDeploying }) => {
{({ isLoading, isDeploying, active }) => {
const loading = isLoading || isDeploying

return (
<Menu.Item
as="a"
content={loading ? 'Exporting...' : 'CodeSandbox'}
icon={{
loading,
name: loading ? 'spinner' : 'connectdevelop',
}}
title="Export to CodeSandbox"
<LabelledButton
iconName={loading ? 'spinner' : 'connectdevelop'}
label={loading ? 'Exporting...' : 'CodeSandbox'}
active={active}
/>
)
}}
Expand All @@ -107,4 +100,4 @@ class ComponentControlsShowCode extends React.Component<
}
}

export default updateForKeys(['exampleCode'])(ComponentControlsShowCode)
export default updateForKeys(['exampleCode', 'active'])(ComponentControlsShowCode)
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
import * as PropTypes from 'prop-types'
import * as React from 'react'
import { Icon, Menu } from 'semantic-ui-react'
import LabelledButton from './ComponentButton'
import * as _ from 'lodash'

export default class ComponentControlsCopyLink extends React.Component<any, any> {
private mounted: boolean
private readonly btnLabel = 'Permalink'

public static propTypes = {
anchorName: PropTypes.string,
onClick: PropTypes.func,
}

public state: any = {}

public shouldComponentUpdate(nextProps, nextState) {
Expand All @@ -26,26 +21,21 @@ export default class ComponentControlsCopyLink extends React.Component<any, any>
}

public render() {
const { anchorName } = this.props
const { active } = this.state

return (
<Menu.Item
href={`#${anchorName}`}
<LabelledButton
iconName="linkify"
label={active ? 'Copied!' : this.btnLabel}
active={active}
onClick={this.handleClick}
color={active ? 'green' : undefined}
>
<Icon color={active ? 'green' : 'grey'} fitted name="linkify" size="large" />
{active ? 'Copied!' : this.btnLabel}
</Menu.Item>
/>
)
}

private handleClick = e => {
const { onClick } = this.props

e.preventDefault()
onClick()
_.invoke(this.props, 'onClick', e, this.props)

this.setState({ active: true })
setTimeout(this.resetActive, 3000)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,10 @@
import * as _ from 'lodash'
import * as PropTypes from 'prop-types'
import * as React from 'react'
import { Icon, Menu } from 'semantic-ui-react'
import { NavLink } from 'react-router-dom'

import { updateForKeys } from 'docs/src/hoc'
import LabelledButton from './ComponentButton'

const ComponentControlsMaximize: any = ({ examplePath, rtl }) => (
<Menu.Item
as={NavLink}
to={`/maximize/${_.kebabCase(examplePath.split('/').slice(-1))}/${rtl}`}
target="_blank"
rel="noopener noreferrer"
>
<Icon color="grey" fitted name="external alternate" size="large" />
Popout
</Menu.Item>
const ComponentControlsMaximize: any = () => (
<LabelledButton iconName="external alternate" label="Popout" active={false} />
)

ComponentControlsMaximize.propTypes = {
examplePath: PropTypes.string.isRequired,
}

export default updateForKeys(['examplePath', 'rtl'])(ComponentControlsMaximize)
export default updateForKeys(['examplePath'])(ComponentControlsMaximize)
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
import * as PropTypes from 'prop-types'
import * as React from 'react'
import { Icon, Menu } from 'semantic-ui-react'

import { updateForKeys } from 'docs/src/hoc'
import LabelledButton from './ComponentButton'

const ComponentControlsShowRtl: React.SFC = ({ active, onClick }: any) => (
<Menu.Item active={active} onClick={onClick}>
<Icon color={active ? 'green' : 'grey'} size="large" name="align right" fitted />
RTL
</Menu.Item>
const ComponentControlsShowRtl: React.SFC = ({ active }: any) => (
<LabelledButton iconName="align right" label="RTL" active={active} />
)

ComponentControlsShowRtl.propTypes = {
Expand Down
Loading