import { useState, useCallback, useRef } from '@wordpress/element'; /** * Persist a piece of React state in localStorage. * * State is lazily initialized from the stored value (parsed as JSON) and falls * back to `defaultValue` when the key is absent or the stored value is malformed. * All localStorage access is wrapped in try/catch so private mode, quota errors * or a missing `window` (SSR) never throw. * * The next value is computed synchronously (from a ref, not from React's * deferred state updater) so the localStorage write always reflects the real * next value, even when `setState` is called from a React event handler where * state updates are batched. * * @param {string} key The localStorage key to read from and write to. * @param {*} defaultValue Value returned when nothing valid is stored. * * @return {Array} `[ state, setState ]` where `setState` accepts a value or an * updater function (like React's setState) and returns the next value. */ const useLocalStorageState = ( key, defaultValue ) => { const [ state, setStateInternal ] = useState( () => { if ( typeof window === 'undefined' ) { return defaultValue; } try { const stored = window.localStorage.getItem( key ); if ( stored === null ) { return defaultValue; } return JSON.parse( stored ); } catch ( error ) { // Missing localStorage or malformed JSON, fall back to the default. return defaultValue; } } ); // Mirror of the latest value so `setState` can resolve an updater // synchronously without depending on React's deferred state update. const stateRef = useRef( state ); stateRef.current = state; const setState = useCallback( ( valueOrUpdater ) => { const nextValue = typeof valueOrUpdater === 'function' ? valueOrUpdater( stateRef.current ) : valueOrUpdater; // Keep the ref current so back-to-back updater calls in the same // tick build on each other rather than on a stale value. stateRef.current = nextValue; try { if ( typeof window !== 'undefined' ) { window.localStorage.setItem( key, JSON.stringify( nextValue ) ); } } catch ( error ) { // Silently ignore write failures (private mode / quota). } setStateInternal( nextValue ); return nextValue; }, [ key ] ); return [ state, setState ]; }; export default useLocalStorageState; .wp-block-uagb-separator{text-align:center;box-sizing:border-box;line-height:0}.wp-block-uagb-separator__inner{display:inline-block}.wp-block-uagb-separator:not(.wp-block-uagb-separator--text):not(.wp-block-uagb-separator--icon) .wp-block-uagb-separator__inner{border-top-style:solid;-webkit-mask:var(--my-background-image);-webkit-mask-size:38px 100%;-webkit-mask-repeat:repeat-x;margin-top:5px;margin-bottom:5px}.wp-block-uagb-separator--text .wp-block-uagb-separator__inner,.wp-block-uagb-separator--icon .wp-block-uagb-separator__inner{display:flex;justify-content:center;align-items:center;margin:0 auto}.wp-block-uagb-separator--text .wp-block-uagb-separator__inner::before,.wp-block-uagb-separator--icon .wp-block-uagb-separator__inner::before{display:block;content:"";border-bottom:0;flex-grow:1;border-top-color:#333;border-top-style:solid;-webkit-mask:var(--my-background-image);-webkit-mask-size:38px 100%;-webkit-mask-repeat:repeat-x}.wp-block-uagb-separator--text .wp-block-uagb-separator__inner::after,.wp-block-uagb-separator--icon .wp-block-uagb-separator__inner::after{display:block;content:"";border-bottom:0;flex-grow:1;border-top-color:#333;border-top-style:solid;-webkit-mask:var(--my-background-image);-webkit-mask-size:38px 100%;-webkit-mask-repeat:repeat-x}.wp-block-uagb-separator--icon .wp-block-uagb-separator-element svg{font-size:30px;color:#333;fill:#333;width:30px;height:30px;line-height:30px;max-width:none}.wp-block-uagb-separator--text .wp-block-uagb-separator-element .uagb-html-tag{word-break:initial;margin:0} .wp-block-uagb-advanced-heading .uagb-heading-text{margin:0;word-wrap:break-word}.wp-block-uagb-advanced-heading .uagb-desc-text{margin:0}.wp-block-uagb-advanced-heading .uagb-separator{font-size:0;border-top-style:solid;display:inline-block;margin:0 0 10px 0}.wp-block-uagb-advanced-heading .srfm-highlight{color:#f78a0c;border:0;transition:all .3s ease}.uag-highlight-toolbar{border-left:0;border-top:0;border-bottom:0;border-radius:0;border-right-color:#1e1e1e}.uag-highlight-toolbar .components-button{border-radius:0;outline:none}.uag-highlight-toolbar .components-button.is-primary{color:#fff} .wp-block-uagb-image{display:flex}.wp-block-uagb-image__figure{position:relative;display:flex;flex-direction:column;max-width:100%;height:auto;margin:0}.wp-block-uagb-image__figure img{height:auto;display:flex;max-width:100%;transition:box-shadow .2s ease}.wp-block-uagb-image__figure>a{display:inline-block}.wp-block-uagb-image__figure figcaption{text-align:center;margin-top:.5em;margin-bottom:1em}.wp-block-uagb-image .components-placeholder.block-editor-media-placeholder .components-placeholder__instructions{align-self:center}.wp-block-uagb-image--align-left{text-align:left}.wp-block-uagb-image--align-right{text-align:right}.wp-block-uagb-image--align-center{text-align:center}.wp-block-uagb-image--align-full .wp-block-uagb-image__figure{margin-left:calc(50% - 50vw);margin-right:calc(50% - 50vw);max-width:100vw;width:100vw;height:auto}.wp-block-uagb-image--align-full .wp-block-uagb-image__figure img{height:auto;width:100% !important}.wp-block-uagb-image--align-wide .wp-block-uagb-image__figure img{height:auto;width:100%}.wp-block-uagb-image--layout-overlay__color-wrapper{position:absolute;left:0;top:0;right:0;bottom:0;opacity:.2;background:rgba(0,0,0,.5);transition:opacity .35s ease-in-out}.wp-block-uagb-image--layout-overlay-link{position:absolute;left:0;right:0;bottom:0;top:0}.wp-block-uagb-image--layout-overlay .wp-block-uagb-image__figure:hover .wp-block-uagb-image--layout-overlay__color-wrapper{opacity:1}.wp-block-uagb-image--layout-overlay__inner{position:absolute;left:15px;right:15px;bottom:15px;top:15px;display:flex;align-items:center;justify-content:center;flex-direction:column;border-color:#fff;transition:.35s ease-in-out}.wp-block-uagb-image--layout-overlay__inner.top-left,.wp-block-uagb-image--layout-overlay__inner.top-center,.wp-block-uagb-image--layout-overlay__inner.top-right{justify-content:flex-start}.wp-block-uagb-image--layout-overlay__inner.bottom-left,.wp-block-uagb-image--layout-overlay__inner.bottom-center,.wp-block-uagb-image--layout-overlay__inner.bottom-right{justify-content:flex-end}.wp-block-uagb-image--layout-overlay__inner.top-left,.wp-block-uagb-image--layout-overlay__inner.center-left,.wp-block-uagb-image--layout-overlay__inner.bottom-left{align-items:flex-start}.wp-block-uagb-image--layout-overlay__inner.top-right,.wp-block-uagb-image--layout-overlay__inner.center-right,.wp-block-uagb-image--layout-overlay__inner.bottom-right{align-items:flex-end}.wp-block-uagb-image--layout-overlay__inner .uagb-image-heading{color:#fff;transition:transform .35s,opacity .35s ease-in-out;transform:translate3d(0, 24px, 0)}.wp-block-uagb-image--layout-overlay__inner .uagb-image-separator{width:30%;border-top-width:2px;border-top-color:#fff;border-top-style:solid;margin-bottom:10px;opacity:0;transition:transform .4s,opacity .4s ease-in-out;transform:translate3d(0, 30px, 0)}.wp-block-uagb-image--layout-overlay__inner .uagb-image-caption{opacity:0;overflow:visible;color:#fff;transition:transform .45s,opacity .45s ease-in-out;transform:translate3d(0, 35px, 0)}.wp-block-uagb-image--layout-overlay__inner:hover .uagb-image-heading,.wp-block-uagb-image--layout-overlay__inner:hover .uagb-image-separator,.wp-block-uagb-image--layout-overlay__inner:hover .uagb-image-caption{opacity:1;transform:translate3d(0, 0, 0)}.wp-block-uagb-image--effect-zoomin .wp-block-uagb-image__figure img,.wp-block-uagb-image--effect-zoomin .wp-block-uagb-image__figure .wp-block-uagb-image--layout-overlay__color-wrapper{transform:scale(1);transition:transform .35s ease-in-out}.wp-block-uagb-image--effect-zoomin .wp-block-uagb-image__figure:hover img,.wp-block-uagb-image--effect-zoomin .wp-block-uagb-image__figure:hover .wp-block-uagb-image--layout-overlay__color-wrapper{transform:scale(1.05)}.wp-block-uagb-image--effect-slide .wp-block-uagb-image__figure img,.wp-block-uagb-image--effect-slide .wp-block-uagb-image__figure .wp-block-uagb-image--layout-overlay__color-wrapper{width:calc(100% + 40px) !important;max-width:none !important;transform:translate3d(-40px, 0, 0);transition:transform .35s ease-in-out}.wp-block-uagb-image--effect-slide .wp-block-uagb-image__figure:hover img,.wp-block-uagb-image--effect-slide .wp-block-uagb-image__figure:hover .wp-block-uagb-image--layout-overlay__color-wrapper{transform:translate3d(0, 0, 0)}.wp-block-uagb-image--effect-grayscale img{filter:grayscale(0%);transition:.35s ease-in-out}.wp-block-uagb-image--effect-grayscale:hover img{filter:grayscale(100%)}.wp-block-uagb-image--effect-blur img{filter:blur(0);transition:.35s ease-in-out}.wp-block-uagb-image--effect-blur:hover img{filter:blur(3px)} .wp-block-uagb-icon svg{width:30px}.uagb-icon-wrapper .uagb-svg-wrapper{transition:box-shadow .2s ease} /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/sv",[],function(){return{errorLoading:function(){return"Resultat kunde inte laddas."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Vänligen sudda ut "+t+" tecken";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Vänligen skriv in "+t+" eller fler tecken";return n},loadingMore:function(){return"Laddar fler resultat…"},maximumSelected:function(e){var t="Du kan max välja "+e.maximum+" element";return t},noResults:function(){return"Inga träffar"},searching:function(){return"Söker…"}}}),{define:e.define,require:e.require}})(); Xia Yu Archives - Nassima | Art Foundation Jump to Content

Xia Yu

b. 1981, Anhui Province, China. Xia Yu is a Beijing-based artist. The figures in his work are perpetually roaming between their residence and work, city and nature, and seamlessly shifting among chores and tasks, daydream and recreation, switching between various identities and roles in the interval of one living space after another. Xia Yu’s paintings precisely expose the defects of a typical life, confronting the dull moments that continually appear, which can be lovely in their unpretentious truthfulness. (Courtesy of Hive Center for Contemporary Art, Beijing).

Keep Moving

2023

Orchid 2

2023

Orchid 1

2023

Silent

2023

Back to top