Skip to content

Commit 76fd1bd

Browse files
committed
Themes: Remove old pattern directory theme
1 parent 7208ff5 commit 76fd1bd

134 files changed

Lines changed: 50 additions & 8234 deletions

File tree

Some content is hidden

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

‎package.json‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
"workspaces": [
3030
"public_html/wp-content/plugins/pattern-creator",
3131
"public_html/wp-content/plugins/pattern-directory",
32-
"public_html/wp-content/themes/pattern-directory",
3332
"public_html/wp-content/themes/wporg-pattern-directory-2024"
3433
]
3534
}

‎public_html/wp-content/plugins/pattern-creator/src/components/openverse/pagination.js‎

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,9 @@ import { __, _x, sprintf } from '@wordpress/i18n';
55
import { Button } from '@wordpress/components';
66

77
/**
8-
* Theme dependencies
9-
*/
10-
// eslint-disable-next-line import/no-unresolved -- imported via alias in webpack.config.js.
11-
import getPaginationList from 'themes/pattern-directory/utils/get-pagination-list';
12-
13-
/*
14-
* Note: forked from theme, `pattern-directory/src/components/pattern-grid/pagination.js`
8+
* Internal dependencies
159
*/
10+
import { getPaginationList } from './utils';
1611

1712
export default function OpenversePagination( { currentPage = 1, onNavigation, totalPages } ) {
1813
if ( ! totalPages || totalPages <= 1 ) {

‎public_html/wp-content/plugins/pattern-creator/src/components/openverse/utils.js‎

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,51 @@ export async function fetchImages( { searchTerm, page = 1 } ) {
3737
throw error;
3838
}
3939
}
40+
41+
/**
42+
* Get the collapsed list of page numbers for a given range of pages, used to paginate queries.
43+
*
44+
* This will return an array of page numbers (1, 2, 3, etc) for a given length (number of pages). If there are
45+
* less than 5 pages (inclusive), it will return 1 through 5. If there are more, it will collapse between the
46+
* start and end with an ellipsis. If the current page is in the middle, it will add pages to the middle.
47+
*
48+
* See test/get-pagination-list.js for examples.
49+
*
50+
* @param {number} length The total number of pages.
51+
* @param {?number} current The current page, used to output extra pages if necessary. Default 1.
52+
* @return {Array.<number|string>} Array of numbers and … used to display pagination links.
53+
*/
54+
export function getPaginationList( length, current = 1 ) {
55+
const range = Array.from( { length }, ( val, i ) => i + 1 );
56+
const list = [];
57+
if ( length <= 5 ) {
58+
return range;
59+
}
60+
list.push( ...range.slice( 0, 2 ) );
61+
if ( current >= 2 && current <= length - 1 ) {
62+
list.push( ...range.slice( current - 2, current + 1 ) );
63+
}
64+
list.push( ...range.slice( -2 ) );
65+
66+
return (
67+
list
68+
// Remove duplicates.
69+
.filter( ( value, i, a ) => a.indexOf( value ) === i )
70+
// Add in … where there's a jump larger than 1.
71+
.reduce( ( acc, value, i, a ) => {
72+
if ( i === 0 ) {
73+
acc.push( value );
74+
return acc;
75+
}
76+
const diff = Math.abs( a[ i ] - a[ i - 1 ] );
77+
if ( diff === 0 ) {
78+
return acc;
79+
}
80+
if ( diff > 1 ) {
81+
acc.push( '…' );
82+
}
83+
acc.push( value );
84+
return acc;
85+
}, [] )
86+
);
87+
}
Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
const path = require( 'path' );
21
const defaultConfig = require( '@wordpress/scripts/config/webpack.config' );
32

43
const config = {
@@ -8,13 +7,6 @@ const config = {
87
library: [ 'wp', 'patternCreator' ],
98
libraryTarget: 'window',
109
},
11-
resolve: {
12-
...defaultConfig.resolve,
13-
alias: {
14-
...defaultConfig.resolve.alias,
15-
'themes/pattern-directory': path.resolve( __dirname, '../../themes/pattern-directory/src/' ),
16-
},
17-
},
1810
};
1911

2012
module.exports = config;

‎public_html/wp-content/themes/pattern-directory/404.php‎

Lines changed: 0 additions & 39 deletions
This file was deleted.

‎public_html/wp-content/themes/pattern-directory/Gruntfile.js‎

Lines changed: 0 additions & 150 deletions
This file was deleted.

‎public_html/wp-content/themes/pattern-directory/README.md‎

Lines changed: 0 additions & 22 deletions
This file was deleted.

‎public_html/wp-content/themes/pattern-directory/css/README.md‎

Lines changed: 0 additions & 46 deletions
This file was deleted.

‎public_html/wp-content/themes/pattern-directory/css/base/_base.scss‎

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)