import React from 'react'
import PropTypes from 'prop-types'
import {BorderBox, Box, Flex, Heading, Link, Text} from '@primer/components'
import {getAssetPath} from '../utils'
import UtilitiesImage from './UtilitiesImage.svg'
import ObjectsImage from './ObjectsImage.svg'
import ComponentsImage from './ComponentsImage.svg'
import SpacingImage from './SpacingImage.svg'
import ColorImage from './ColorImage.svg'
export {default as PrimerCSSAnimation} from './PrimerCSSAnimation.js'
const OverviewTitle = props =>
const OverviewText = props =>
export function StylesOverview(props) {
const styleTypes = [
{
name: 'Utilities',
desc: 'Single purpose, immutable styles, that do one thing well.',
image: UtilitiesImage
},
{
name: 'Objects',
desc: 'Scaffolding for common page and content layouts.',
image: ObjectsImage
},
{
name: 'Components',
desc: 'Abstracted patterns for frequently used visual styles.',
image: ComponentsImage
}
]
return (
{styleTypes.map(({name, desc, image}) => (
{name}{desc}
))}
)
}
StylesOverview.propTypes = {
types: PropTypes.arrayOf(
PropTypes.shape({
name: PropTypes.node,
desc: PropTypes.node,
image: PropTypes.func
})
)
}
export function PrimitivesOverview(props) {
const primitiveTypes = [
{
name: 'Highly composable spacing scale',
desc: `The base-8 spacing scale is highly composable and works with the density of GitHub’s content. Margin and padding spacers bring consistency to vertical and horizontal rhythm, while remaining flexible so you can tweak layouts to work for every context.`,
image: SpacingImage
},
{
name: 'Customizable typography',
desc: `Font size and line-height options work together to result in more sensible numbers. Font styles come in a range of weights and sizes so that we can style appropriately for content and readability. Type utilities allow us to change the visual styles while keeping markup semantic.`,
image: getAssetPath('typography.png')
},
{
name: 'Meaningful color',
desc: `The color system allows us to add meaningful signals to content and interactions. Color variables and utilities offer thematic styling options without being tied to structure. Text and background colors come in a range of accessible combinations to ensure we build inclusive interfaces.`,
image: ColorImage
}
]
return (
{primitiveTypes.map(({name, desc, image}) => (
{name}{desc}
))}
)
}
PrimitivesOverview.propTypes = {
types: PropTypes.arrayOf(
PropTypes.shape({
name: PropTypes.node,
desc: PropTypes.node,
image: PropTypes.func
})
)
}
function Image(props) {
const {src, ...rest} = props
switch (typeof src) {
case 'string':
return
case 'function':
return
default:
throw new Error(`Unrecognized Image.src type: "${typeof src}"`)
}
}
export function PrimerPackageBox({count, ...rest}) {
return (
Primer
{count ? (
This package includes all {count} Primer modules.
) : null}
)
}
PrimerPackageBox.propTypes = {
count: PropTypes.number
}
export function MetaPackageBox({children, meta = {}, title, ...rest}) {
const {name, imports = []} = meta
const bundles = imports.filter(bundle => !/support/.test(bundle))
return (
{title}
{children}
{bundles.length} bundles:
{bundles.map(bundle => (
{/* TODO: link to the actual page! */}
{bundle}
))}
)
}
MetaPackageBox.propTypes = {
meta: PropTypes.shape({
name: PropTypes.string,
imports: PropTypes.arrayOf(PropTypes.string)
}),
title: PropTypes.node
}
function bundleURL(name) {
return `/css/bundle?name=${name}`
}
function bundleSourceURL(name, branch = 'master') {
// TODO get this from Metalsmith or page metadata???
return `https://github.com/primer/css/blob/${branch}/src/${name}`
}