Skip to content

Commit

Permalink
Gallery full screen
Browse files Browse the repository at this point in the history
  • Loading branch information
hide-on-bush-x committed Apr 27, 2023
1 parent b55ede4 commit fd183a4
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 12 deletions.
Expand Up @@ -4,7 +4,6 @@ import { Meta, StoryObj } from '@storybook/react';
import { Gallery } from '.';
import { GalleryItem } from './galleryItem';


const customRenderPokeSBT = {
name: 'PokeSBT',
address: '0xD1C64fa4aDc003Ed92A10558572CbC499C7cA18A',
Expand Down
5 changes: 1 addition & 4 deletions src/components/masa-interface/pages/gallery/gallery.tsx
Expand Up @@ -40,10 +40,7 @@ export interface CustomGallerySBT {
}>;
}
export const Gallery = ({ setIndex, context }) => {
const { useModalSize, masa, connect } = useMasa();

useModalSize?.({ width: 1100, height: 800 });

const { masa, connect } = useMasa();
return (
<div className="masa-gallery-container">
{masa ? (
Expand Down
13 changes: 12 additions & 1 deletion src/components/masa-interface/pages/gallery/index.tsx
Expand Up @@ -147,7 +147,18 @@ const useSavedSbts = (prefix): any[] => {

const GalleryContainer = () => {
const pages = [Gallery];
const { soulnames, greens, creditScores } = useMasa();
const { soulnames, greens, creditScores, useModalSize, fullScreenGallery } =
useMasa();

useModalSize?.(
fullScreenGallery
? {
width: window.innerWidth * 0.95,
height: window.innerHeight * 0.95,
}
: { width: 1100, height: 800 }
);

const { sbts, badges } = useTabs();

const tabs: Tabs[] = [
Expand Down
9 changes: 6 additions & 3 deletions src/components/modal/styles.scss
Expand Up @@ -652,13 +652,16 @@
background-color: black;

width: calc((100% - 80px) / 4);
max-height: 50%;
max-width: 250px;
max-height: 340px;

display: flex;
flex-direction: column;
align-items: center;
z-index: 20;
perspective: 1000px;

&:hover {
background-color: rgba(0, 0, 0, 0.8);
}

img {
width: 100%;
Expand Down
7 changes: 5 additions & 2 deletions src/provider/masa-context-provider.tsx
Expand Up @@ -40,6 +40,7 @@ export interface MasaContextProviderProps extends MasaShape {
environmentName?: EnvironmentNameEx;
arweaveConfig?: ArweaveConfig;
customGallerySBT?: CustomGallerySBT[];
fullScreenGallery?: boolean;
}

export const MasaContextProvider = ({
Expand All @@ -58,8 +59,10 @@ export const MasaContextProvider = ({
verbose = false,
// force specific network
forceNetwork,
// Custom SBT render for gallery
// custom SBT render for gallery
customGallerySBT,
// render gallery in full screen
fullScreenGallery,
}: MasaContextProviderProps): JSX.Element => {
// masa
const [masaInstance, setMasaInstance] = useState<Masa | undefined>();
Expand Down Expand Up @@ -291,7 +294,7 @@ export const MasaContextProvider = ({

// gallery
customGallerySBT,

fullScreenGallery,
// custom SBTs
customSBTs,
};
Expand Down
2 changes: 1 addition & 1 deletion src/provider/masa-shape.ts
Expand Up @@ -112,7 +112,7 @@ export interface MasaShape {

// gallery
customGallerySBT?: CustomGallerySBT[];

fullScreenGallery?: boolean;
// customSBTs
customSBTs?: any[];
}
1 change: 1 addition & 0 deletions stories/masa.stories.tsx
Expand Up @@ -262,6 +262,7 @@ const Template: Story = (props: Args) => {
company="Masa"
forceNetwork={'goerli'}
customGallerySBT={[customRenderPokeSBT]}
fullScreenGallery
>
<Component {...props} />
</MasaProvider>
Expand Down

0 comments on commit fd183a4

Please sign in to comment.