Skip to content
This repository was archived by the owner on Feb 27, 2024. It is now read-only.

Commit 226578a

Browse files
committed
Merge branch 'staging' into develop
2 parents df8e8ee + 08d35fc commit 226578a

File tree

141 files changed

+2012
-1604
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

141 files changed

+2012
-1604
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import Link from 'next/link'
2+
import PropTypes from 'prop-types'
3+
import styles from './Breadcrumbs.module.css'
4+
5+
/**
6+
* Render the Breadcrumbs component.
7+
*
8+
* @author WebDevStudios
9+
* @param {object} props The component attributes as props.
10+
* @param {Array} props.breadcrumbs The breadcrumb array.
11+
* @return {Element} The Breadcrumbs component.
12+
*/
13+
export default function Breadcrumbs({breadcrumbs}) {
14+
return (
15+
<>
16+
{!!breadcrumbs?.length && (
17+
<ul className={styles.breadcrumbs}>
18+
{breadcrumbs.map((breadcrumb, index) => (
19+
<li key={index}>
20+
<Link href={breadcrumb?.url}>
21+
<a>{breadcrumb?.text}</a>
22+
</Link>
23+
{index < breadcrumbs.length - 1 && (
24+
<span className={styles.sep}> &raquo; </span>
25+
)}
26+
</li>
27+
))}
28+
</ul>
29+
)}
30+
</>
31+
)
32+
}
33+
34+
Breadcrumbs.propTypes = {
35+
breadcrumbs: PropTypes.array.isRequired
36+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
ul.breadcrumbs {
2+
@apply mb-8 flex;
3+
4+
& li {
5+
@apply text-sm font-semibold;
6+
7+
& .sep {
8+
@apply px-2 opacity-50 font-normal;
9+
}
10+
}
11+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import {Meta, Story, Canvas} from '@storybook/addon-docs/blocks'
2+
3+
import Breadcrumbs from '.'
4+
5+
export const crumbs = [
6+
{
7+
text: 'Home',
8+
url: '/'
9+
},
10+
{
11+
text: 'About',
12+
url: '/about'
13+
},
14+
{
15+
text: 'Our Team',
16+
url: '/about/team'
17+
}
18+
]
19+
20+
<Meta title="Components/Atoms/Breadcrumbs" component={Breadcrumbs} />
21+
22+
# Breadcrumbs
23+
24+
Use this component to display site breadcrumbs.
25+
26+
<Canvas>
27+
<Story name="Component">
28+
<Breadcrumbs breadcrumbs={crumbs} />
29+
</Story>
30+
</Canvas>

components/atoms/Breadcrumbs/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export {default} from './Breadcrumbs'

components/atoms/Button/Button.module.css

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
.button {
2-
@apply inline-flex items-center justify-center rounded border transition-colors duration-150 ease-in-out cursor-pointer uppercase font-secondary;
2+
@apply inline-flex items-center justify-center rounded border transition-colors duration-150 ease-in-out cursor-pointer uppercase;
33

44
& svg {
55
@apply ml-12;
@@ -21,19 +21,19 @@
2121

2222
/* SIZES */
2323
&.lg {
24-
@apply px-16 py-12 text-h5;
24+
@apply px-6 py-3;
2525

2626
line-height: 1.5625rem;
2727
}
2828

2929
&.md {
30-
@apply px-16 py-12 text-sm;
30+
@apply px-3 py-1.5;
3131

3232
line-height: 1.25rem;
3333
}
3434

3535
&.sm {
36-
@apply px-16 py-8 text-caption;
36+
@apply px-1.5 py-0.5;
3737

3838
line-height: 1.0625rem;
3939
}
@@ -44,15 +44,15 @@
4444

4545
/* TYPES */
4646
&.primary {
47-
@apply bg-primary text-white border-white border-opacity-0;
47+
@apply bg-white;
4848

4949
&.disabled {
5050
@apply opacity-50;
5151
}
5252
}
5353

5454
&.secondary {
55-
@apply bg-white bg-opacity-0 text-primary border-primary;
55+
@apply bg-black text-white;
5656

5757
&.disabled {
5858
@apply opacity-50;

components/atoms/Code/Code.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
import PropTypes from 'prop-types'
22
import React from 'react'
3-
import styles from './Code.module.css'
43
import {Prism as SyntaxHighlighter} from 'react-syntax-highlighter'
54
import {tomorrow} from 'react-syntax-highlighter/dist/cjs/styles/prism'
5+
import styles from './Code.module.css'
66

77
/**
88
* Render the Code component.
99
*
1010
* @author WebDevStudios
11-
* @param {object} props The component attributes as props.
12-
* @param {string} props.className Optional classname.
13-
* @param props.id
14-
* @param props.content
15-
* @param {boolean} props.fullWidth Is this a fullwidth block.
16-
* @return {Element} The Code component.
11+
* @param {object} props The component attributes as props.
12+
* @param {string} props.className Optional classname.
13+
* @param {string} props.id The optional ID.
14+
* @param {string} props.content The content for inside the code block.
15+
* @return {Element} The Code component.
1716
*/
1817
export default function Code({id, className, content}) {
1918
// Use the className to pass the langauge.

components/atoms/Code/Code.module.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
@apply mb-40;
33

44
& > pre {
5-
@apply rounded-larger;
5+
@apply rounded;
66
}
77
}
Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,38 @@
11
import PropTypes from 'prop-types'
22
import React from 'react'
33
import styles from './Container.module.css'
4+
import cn from 'classnames'
45

56
/**
67
* Render the Container component.
78
*
8-
* @param {object} props Container component props.
9-
* @param {Element} props.children Container children.
10-
* @return {Element} The Container component.
9+
* @param {object} props Container component props.
10+
* @param {object} props.children Container children.
11+
* @param {boolean} props.paddingTop Should container render top padding.
12+
* @param {boolean} props.paddingBtm Should container render bottom padding.
13+
* @return {Element} The Container component.
1114
*/
12-
export default function Container({children}) {
13-
return <div className={styles.containerW}>{children && children}</div>
15+
export default function Container({children, paddingTop, paddingBtm}) {
16+
return (
17+
<div
18+
className={cn(
19+
styles.containerW,
20+
paddingTop && styles.paddingTop,
21+
paddingBtm && styles.paddingBtm
22+
)}
23+
>
24+
{children && children}
25+
</div>
26+
)
1427
}
1528

1629
Container.propTypes = {
17-
children: PropTypes.element
30+
children: PropTypes.node,
31+
paddingTop: PropTypes.bool,
32+
paddingBtm: PropTypes.bool
33+
}
34+
35+
Container.defaultProps = {
36+
paddingTop: true,
37+
paddingBtm: true
1838
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
11
.containerW {
22
@apply container;
3+
4+
&.paddingTop {
5+
@apply pt-12;
6+
}
7+
8+
&.paddingBtm {
9+
@apply pb-12;
10+
}
311
}

components/atoms/Heading/Heading.js

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import createMarkup from '@/functions/createMarkup'
2+
import PropTypes from 'prop-types'
3+
import React from 'react'
4+
5+
/**
6+
* Render the Heading component.
7+
*
8+
* @param {object} props The props object.
9+
* @param {string} props.children The elements or text you'd like to render inside the heading.
10+
* @param {string} props.className The optional classname.
11+
* @param {string} props.id The optional ID.
12+
* @param {string} props.tag The tag name you'd like the heading to render as.
13+
* @return {Element} The Heading element.
14+
*/
15+
export default function Heading({children, className, id, tag}) {
16+
if (typeof children === 'string') {
17+
return React.createElement(tag, {
18+
className,
19+
id,
20+
dangerouslySetInnerHTML: createMarkup(children)
21+
})
22+
} else {
23+
return React.createElement(
24+
tag,
25+
{
26+
className,
27+
id
28+
},
29+
children
30+
)
31+
}
32+
}
33+
34+
Heading.propTypes = {
35+
children: PropTypes.oneOfType([PropTypes.node, PropTypes.string]),
36+
className: PropTypes.string,
37+
id: PropTypes.string,
38+
tag: PropTypes.oneOf(['h1', 'h2', 'h3', 'h4', 'h5', 'h6'])
39+
}
40+
41+
Heading.defaultProps = {
42+
tag: 'h1'
43+
}

0 commit comments

Comments
 (0)