-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4c54231
commit 01b53b2
Showing
16 changed files
with
249 additions
and
228 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 |
---|---|---|
@@ -1,9 +1,9 @@ | ||
/* eslint-disable @typescript-eslint/no-var-requires */ | ||
const withSourceMaps = require('@zeit/next-source-maps')() | ||
const withSourceMaps = require('@zeit/next-source-maps')(); | ||
|
||
const isProd = (process.env.NODE_ENV || 'production') === 'production' | ||
const isProd = (process.env.NODE_ENV || 'production') === 'production'; | ||
|
||
module.exports = withSourceMaps({ | ||
assetPrefix: isProd ? '/next-pagination' : undefined, | ||
basePath: isProd ? '/next-pagination' : undefined | ||
}) | ||
basePath: isProd ? '/next-pagination' : undefined, | ||
}); |
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
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
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 |
---|---|---|
@@ -1,61 +1,61 @@ | ||
import React from 'react' | ||
import PropTypes from 'prop-types' | ||
import PropTypes from 'prop-types'; | ||
import React from 'react'; | ||
|
||
// Icons from: https://material.io/resources/icons/?style=round | ||
|
||
type IconName = 'chevron-left' | 'chevron-right' | 'expand-more' | ||
type IconName = 'chevron-left' | 'chevron-right' | 'expand-more'; | ||
|
||
function path(icon: IconName) { | ||
switch (icon) { | ||
case 'chevron-left': | ||
return ( | ||
<React.Fragment> | ||
<path d='M0 0h24v24H0V0z' fill='none' /> | ||
<path d="M0 0h24v24H0V0z" fill="none" /> | ||
<path | ||
fill='currentColor' | ||
d='M14.71 6.71c-.39-.39-1.02-.39-1.41 0L8.71 11.3c-.39.39-.39 1.02 0 1.41l4.59 4.59c.39.39 1.02.39 1.41 0 .39-.39.39-1.02 0-1.41L10.83 12l3.88-3.88c.39-.39.38-1.03 0-1.41z' | ||
fill="currentColor" | ||
d="M14.71 6.71c-.39-.39-1.02-.39-1.41 0L8.71 11.3c-.39.39-.39 1.02 0 1.41l4.59 4.59c.39.39 1.02.39 1.41 0 .39-.39.39-1.02 0-1.41L10.83 12l3.88-3.88c.39-.39.38-1.03 0-1.41z" | ||
/> | ||
</React.Fragment> | ||
) | ||
); | ||
case 'chevron-right': | ||
return ( | ||
<React.Fragment> | ||
<path d='M0 0h24v24H0V0z' fill='none' /> | ||
<path d="M0 0h24v24H0V0z" fill="none" /> | ||
<path | ||
fill='currentColor' | ||
d='M9.29 6.71c-.39.39-.39 1.02 0 1.41L13.17 12l-3.88 3.88c-.39.39-.39 1.02 0 1.41.39.39 1.02.39 1.41 0l4.59-4.59c.39-.39.39-1.02 0-1.41L10.7 6.7c-.38-.38-1.02-.38-1.41.01z' | ||
fill="currentColor" | ||
d="M9.29 6.71c-.39.39-.39 1.02 0 1.41L13.17 12l-3.88 3.88c-.39.39-.39 1.02 0 1.41.39.39 1.02.39 1.41 0l4.59-4.59c.39-.39.39-1.02 0-1.41L10.7 6.7c-.38-.38-1.02-.38-1.41.01z" | ||
/> | ||
</React.Fragment> | ||
) | ||
); | ||
case 'expand-more': | ||
return ( | ||
<React.Fragment> | ||
<path d='M24 24H0V0h24v24z' fill='none' opacity='.87' /> | ||
<path d="M24 24H0V0h24v24z" fill="none" opacity=".87" /> | ||
<path | ||
fill='currentColor' | ||
d='M15.88 9.29L12 13.17 8.12 9.29c-.39-.39-1.02-.39-1.41 0-.39.39-.39 1.02 0 1.41l4.59 4.59c.39.39 1.02.39 1.41 0l4.59-4.59c.39-.39.39-1.02 0-1.41-.39-.38-1.03-.39-1.42 0z' | ||
fill="currentColor" | ||
d="M15.88 9.29L12 13.17 8.12 9.29c-.39-.39-1.02-.39-1.41 0-.39.39-.39 1.02 0 1.41l4.59 4.59c.39.39 1.02.39 1.41 0l4.59-4.59c.39-.39.39-1.02 0-1.41-.39-.38-1.03-.39-1.42 0z" | ||
/> | ||
</React.Fragment> | ||
) | ||
); | ||
default: | ||
return '' | ||
return ''; | ||
} | ||
} | ||
|
||
export default function Icon({ icon }: { icon: IconName }) { | ||
return ( | ||
<svg | ||
className='next-pagination__icon' | ||
aria-hidden='true' | ||
viewBox='0 0 24 24' | ||
width='24' | ||
height='24' | ||
className="next-pagination__icon" | ||
aria-hidden="true" | ||
viewBox="0 0 24 24" | ||
width="24" | ||
height="24" | ||
> | ||
{path(icon)} | ||
</svg> | ||
) | ||
); | ||
} | ||
|
||
Icon.propTypes = { | ||
icon: PropTypes.string.isRequired | ||
} | ||
icon: PropTypes.string.isRequired, | ||
}; |
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 |
---|---|---|
@@ -1,11 +1,11 @@ | ||
import React from 'react' | ||
import React from 'react'; | ||
|
||
interface ItemProps { | ||
children: React.ReactNode | ||
theme: { [key: string]: any } | ||
[key: string]: any | ||
readonly children: React.ReactNode; | ||
readonly theme: { [key: string]: any }; | ||
[key: string]: any; | ||
} | ||
|
||
export default function Item({ children, theme }: ItemProps) { | ||
return <li className={theme['next-pagination__item']}>{children}</li> | ||
return <li className={theme['next-pagination__item']}>{children}</li>; | ||
} |
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 |
---|---|---|
@@ -1,27 +1,27 @@ | ||
import React from 'react' | ||
import classNames from 'classnames' | ||
import classNames from 'classnames'; | ||
import React from 'react'; | ||
|
||
interface LinkProps { | ||
children: React.ReactNode | ||
label: string | ||
theme: { [key: string]: any } | ||
current?: boolean | ||
disabled?: boolean | ||
[key: string]: any | ||
readonly children: React.ReactNode; | ||
readonly label: string; | ||
readonly theme: { [key: string]: any }; | ||
readonly current?: boolean; | ||
readonly disabled?: boolean; | ||
[key: string]: any; | ||
} | ||
|
||
export default class Link extends React.Component<LinkProps> { | ||
render() { | ||
const { children, current, disabled, label, theme, ...props } = this.props | ||
const { children, current, disabled, label, theme, ...props } = this.props; | ||
const cx = classNames(theme['next-pagination__link'], { | ||
[`${theme['next-pagination__link--current']}`]: current, | ||
[`${theme['next-pagination__link--disabled']}`]: disabled | ||
}) | ||
[`${theme['next-pagination__link--disabled']}`]: disabled, | ||
}); | ||
|
||
return ( | ||
<a className={cx} aria-label={label} aria-current={current} {...props}> | ||
{children} | ||
</a> | ||
) | ||
); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,11 +1,10 @@ | ||
import React from 'react' | ||
import PropTypes from 'prop-types' | ||
import React from 'react'; | ||
|
||
interface ListProps { | ||
children: React.ReactNode | ||
theme: { [key: string]: any } | ||
readonly children: React.ReactNode; | ||
readonly theme: { [key: string]: any }; | ||
} | ||
|
||
export default function List({ children, theme }: ListProps) { | ||
return <ul className={theme['next-pagination__list']}>{children}</ul> | ||
return <ul className={theme['next-pagination__list']}>{children}</ul>; | ||
} |
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 |
---|---|---|
@@ -1,20 +1,20 @@ | ||
import React from 'react' | ||
import PropTypes from 'prop-types' | ||
import Icon from './Icon' | ||
import React from 'react'; | ||
|
||
import Icon from './Icon'; | ||
|
||
interface SelectProps { | ||
children: React.ReactNode | ||
theme: { [key: string]: any } | ||
[key: string]: any | ||
readonly children: React.ReactNode; | ||
readonly theme: { [key: string]: any }; | ||
[key: string]: any; | ||
} | ||
|
||
const Select = ({ children, theme, ...props }: SelectProps) => ( | ||
<div className={theme['next-pagination__select']}> | ||
<select {...props}>{children}</select> | ||
<span className={theme['next-pagination__select-suffix']}> | ||
<Icon icon='expand-more' /> | ||
<Icon icon="expand-more" /> | ||
</span> | ||
</div> | ||
) | ||
); | ||
|
||
export default Select | ||
export default Select; |
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 |
---|---|---|
@@ -1 +1 @@ | ||
declare module '*.scss' | ||
declare module '*.scss'; |
Oops, something went wrong.