Skip to content

Commit

Permalink
Merge pull request #1701 from bgoonz/preview
Browse files Browse the repository at this point in the history
  • Loading branch information
bgoonz authored Feb 27, 2022
2 parents 64f657d + e6d077e commit a85cc2d
Show file tree
Hide file tree
Showing 38 changed files with 1,987 additions and 1,259 deletions.
27 changes: 27 additions & 0 deletions src/components/Action.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import React from 'react';
import _ from 'lodash';

import { Link, withPrefix } from '../utils';

export default class Action extends React.Component {
render() {
const action = _.get(this.props, 'action');
const url = _.get(action, 'url');
const label = _.get(action, 'label');
const newWindow = _.get(action, 'new_window');
const noFollow = _.get(action, 'no_follow');
const attrs = {};
if (newWindow) {
attrs.target = '_blank';
}
if (newWindow || noFollow) {
attrs.rel = [(newWindow ? 'noopener' : '') + (noFollow ? 'nofollow' : '')].join(' ');
}

return (
<Link href={withPrefix(url)} {...attrs}>
{label}
</Link>
);
}
}
40 changes: 40 additions & 0 deletions src/components/ActionIcon.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import React from 'react';
import _ from 'lodash';

import { Link, withPrefix, classNames } from '../utils';
import Icon from './Icon';

export default class ActionIcon extends React.Component {
render() {
const action = _.get(this.props, 'action');
const url = _.get(action, 'url');
const label = _.get(action, 'label');
const style = _.get(action, 'style', 'link');
const icon = _.get(action, 'icon_class', 'dev');
const classes = classNames({
'button-circle': style === 'icon'
});
const newWindow = _.get(action, 'new_window');
const noFollow = _.get(action, 'no_follow');
const attrs = {};
if (newWindow) {
attrs.target = '_blank';
}
if (newWindow || noFollow) {
attrs.rel = [(newWindow ? 'noopener' : '') + (noFollow ? 'nofollow' : '')].join(' ');
}

return (
<Link href={withPrefix(url)} {...attrs} className={classes}>
{style === 'icon' && icon ? (
<React.Fragment>
<Icon icon={icon} />
<span className="screen-reader-text">{label}</span>
</React.Fragment>
) : (
label
)}
</Link>
);
}
}
178 changes: 19 additions & 159 deletions src/components/Footer.js
Original file line number Diff line number Diff line change
@@ -1,169 +1,29 @@
import _ from 'lodash';
import React from 'react';
import { htmlToReact } from '../utils';
import ActionLink from './ActionLink';
import _ from 'lodash';

import Action from './Action';
import { htmlToReact, Link } from '../utils';

export default class Footer extends React.Component {
render() {
const config = _.get(this.props, 'config');
const footer = _.get(config, 'footer');
const copyright = _.get(footer, 'content');
const links = _.get(footer, 'links');

return (
<footer id="colophon" className="site-footer outer">
<div>
<center>
<table cellPadding={0} cellSpacing={0} border={0}>
<tbody>
<tr>
<td
style={{
fontFamily: 'Arial, Helvetica, sans-serif',
fontSize: '7.5pt'
}}
>
<center>
<table
width="95%"
cellPadding={0}
cellSpacing={0}
border={0}
style={{
fontFamily: 'Arial, Helvetica, sans-serif',
fontSize: '7.5pt'
}}
>
<tbody>
<tr>
<td
style={{
fontFamily: 'Arial, Helvetica, sans-serif',
fontSize: '7.5pt'
}}
align="left"
>
<a target="_blank" href="https://search.freefind.com/siteindex.html?si=14588965">
index
</a>
</td>
<td
style={{
fontFamily: 'Arial, Helvetica, sans-serif',
fontSize: '7.5pt'
}}
align="center"
>
<a target="_blank" href="https://search.freefind.com/find.html?si=14588965&m=0&p=0">
sitemap
</a>
</td>
<td
style={{
fontFamily: 'Arial, Helvetica, sans-serif',
fontSize: '7.5pt'
}}
align="right"
>
<a target="_blank" href="https://search.freefind.com/find.html?si=14588965&pid=a">
advanced
</a>
</td>
</tr>
</tbody>
</table>
</center>
<form
style={{
margin: '0px',
marginTop: '2px'
}}
action="https://search.freefind.com/find.html"
method="get"
acceptCharset="utf-8"
target="_self"
>
<input type="hidden" name="si" defaultValue={14588965} />
<input type="hidden" name="pid" defaultValue="r" />
<input type="hidden" name="n" defaultValue={0} />
<input type="hidden" name="_charset_" defaultValue />
<input type="hidden" name="bcd" defaultValue="÷" />
<input type="text" name="query" size={15} />
<input type="submit" defaultValue="search" />
</form>
</td>
</tr>
<tr>
<td
style={{
textAlign: 'center',
fontFamily: 'Arial, Helvetica, sans-serif',
fontSize: '7.5pt',
paddingTop: '4px'
}}
>
<a
style={{
textDecoration: 'none',
color: 'transparent'
}}
href="https://www.freefind.com"
rel="nofollow"
>
search engine
</a>
<a
style={{
textDecoration: 'none',
color: 'transparent'
}}
href="https://www.freefind.com"
rel="nofollow"
>
by
<span style={{ color: 'transparent' }}>freefind</span>
</a>
{/* {
<iframe
src="https://bgoonz.github.io/fb-and-twitter-api-embeds/"
frameborder="0"
id="social-embed"
width="100%!important"
></iframe>
} */}
</td>
</tr>
</tbody>
</table>
<a
className="save2PDF"
href="//pdfcrowd.com/url_to_pdf/?"
onclick="if(!this.p)href+='&url='+encodeURIComponent(location.href);this.p=1"
>
Save to PDF
</a>
</center>
<a aria-current="page" className="site-logo" href="/">
<img
src="https://d33wubrfki0l68.cloudfront.net/e5662f0d4f3e7730aea1a0faf7ff09ea20184700/6ca0b/images/dgqlkqjtmk.png"
alt="webdevhub logo"
/>
</a>
</div>
<div className="inner">
<footer id="colophon" className="site-footer inner">
{(copyright || !_.isEmpty(links)) && (
<div className="site-footer-inside">
<p className="site-info">
{_.get(this.props, 'pageContext.site.siteMetadata.footer.content', null) && (
<span className="copyright">{htmlToReact(_.get(this.props, 'pageContext.site.siteMetadata.footer.content', null))}</span>
)}
{_.map(_.get(this.props, 'pageContext.site.siteMetadata.footer.links', null), (action, action_idx) => (
<ActionLink key={action_idx} {...this.props} action={action} />
))}{' '}
</p>
{_.get(this.props, 'pageContext.site.siteMetadata.footer.has_social', null) && (
<div className="social-links">
{_.map(_.get(this.props, 'pageContext.site.siteMetadata.footer.social_links', null), (action, action_idx) => (
<ActionLink key={action_idx} {...this.props} action={action} />
))}{' '}
</div>
)}{' '}
{copyright && <span className="copyright">{htmlToReact(copyright)}</span>}
{_.map(links, (action, index) => (
<Action key={index} action={action} />
))}
</div>
</div>
)}
<Link id="to-top" className="to-top" href="#page">
To top <span className="icon-arrow-up" aria-hidden="true" />
</Link>
</footer>
);
}
Expand Down
62 changes: 62 additions & 0 deletions src/components/FormField.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import React from 'react';
import _ from 'lodash';

export default class FormField extends React.Component {
render() {
const field = _.get(this.props, 'field');
const inputType = _.get(field, 'input_type');
const name = _.get(field, 'name');
const defaultValue = _.get(field, 'default_value');
const options = _.get(field, 'options');
const required = _.get(field, 'is_required');
const label = _.get(field, 'label');
const labelId = `${name}-label`;
const attr = {};
if (label) {
attr['aria-labelledby'] = labelId;
}
if (required) {
attr.required = true;
}

switch (inputType) {
case 'checkbox':
return (
<div className="form-group form-checkbox">
<input type="checkbox" id={name} name={name} {...attr} />
{label && <label htmlFor={name}>{label}</label>}
</div>
);
case 'select':
return (
<div className="form-group">
{label && <label htmlFor={name}>{label}</label>}
<div className="form-select-wrap">
<select id={name} name={name} {...attr}>
{defaultValue && <option value="">{defaultValue}</option>}
{_.map(options, (option, index) => (
<option key={index} value={option}>
{option}
</option>
))}
</select>
</div>
</div>
);
case 'textarea':
return (
<div className="form-group">
{label && <label htmlFor={name}>{label}</label>}
<textarea name={name} id={name} rows="7" {...(defaultValue ? { placeholder: defaultValue } : null)} {...attr} />
</div>
);
default:
return (
<div className="form-group">
{label && <label htmlFor={name}>{label}</label>}
<input type={inputType} name={name} id={name} {...(defaultValue ? { placeholder: defaultValue } : null)} {...attr} />
</div>
);
}
}
}
Loading

0 comments on commit a85cc2d

Please sign in to comment.