How to use the @dhis2/d2-ui-core.withStateFrom function in @dhis2/d2-ui-core

To help you get started, we’ve selected a few @dhis2/d2-ui-core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dhis2 / d2-ui / packages / header-bar / src / search / SearchResults.js View on Github external
return (
         setHovering(true)} onMouseLeave={() => setHovering(false)}>
            <div style="{{">
                {searchResultBoxContent}
            </div>
            <div style="{styles.moreAppsButtonWrap}">
                {moreAppsButton}
            </div>
        
    );
}

// Connect the store to the SearchResults component
// TODO: This means we can only have one search results at all times (Perhaps make this more dynamic?)
const SearchResultsWithState = withStateFrom(searchStore$, addD2Context(SearchResults));

export default SearchResultsWithState;
github dhis2 / d2-ui / packages / header-bar / src / search / SearchField.js View on Github external
this.setState({ hasFocus: false });
        hideWhenNotHovering();
    }

    onKeyUp(event) {
        handleKeyPress(event, Math.floor(event.currentTarget.clientWidth / MENU_ITEM_WIDTH));
    }
}

SearchField.contextTypes = {
    d2: PropTypes.object.isRequired,
};

const StyledSearchField = withStyles(searchFieldStyles)(SearchField);

export default withStateFrom(searchStore$, StyledSearchField);
github dhis2 / d2-ui / packages / legend / src / EditLegendItem.component.js View on Github external
&gt;

            

        
    );
}
EditLegendItem.contextTypes = {
    d2: PropTypes.object,
};

export default withStateFrom(legendItemStore$, EditLegendItem);
github dhis2 / d2-ui / packages / header-bar / src / HeaderBar.js View on Github external
HeaderBar.childContextTypes = {
    d2: PropTypes.object,
};

HeaderBar.propTypes = {
    notifications: PropTypes.object,
    profileItems: PropTypes.array,
    noLoadingIndicator: PropTypes.bool,
    d2: PropTypes.object.isRequired,
};

HeaderBar.defaultProps = {
    notifications: {},
};

export default withStateFrom(headerBarStore$, HeaderBar);