Making WordPress.org


Ignore:
Timestamp:
11/18/2016 03:00:24 AM (8 years ago)
Author:
tellyworth
Message:

Plugin directory: tentatively use React for the screenshot slider only.

React is still disabled by default till this is confirmed.

See #2246

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/client/index.jsx

    r4223 r4373  
    11import React from 'react';
    22import { render } from 'react-dom';
    3 import { Provider } from 'react-redux';
    43
    5 import Router from 'modules/router';
    6 import getStore from 'modules/store';
     4import Screenshots from 'components/plugin/sections/screenshots';
     5
     6// Temporary hack to use the srceenshot viewer without the full React client
     7var elements = document.querySelectorAll( '#screenshots figure' );
     8var images = [];
     9for ( var i=0; i < elements.length; i++ ) {
     10    var item = {
     11        src: elements[i].querySelector('img.screenshot').src,
     12        caption: elements[i].querySelector('figcaption').textContent,
     13    }
     14    images.push( item );
     15}
    716
    817render(
    9     <Provider store={ getStore() }>
    10         { Router }
    11     </Provider>,
    12     document.getElementById( 'content' )
     18    <Screenshots screenshots={images}>
     19    </Screenshots>,
     20    document.getElementById( 'screenshots' )
    1321);
Note: See TracChangeset for help on using the changeset viewer.