Skip to content

Commit

Permalink
Merge pull request #22 from jameshawkinscodes/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
jameshawkinscodes authored Dec 18, 2024
2 parents c4a0804 + 24596ef commit 6e64067
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sharepoint-blurb-web-part",
"version": "0.1.0",
"version": "0.2.2",
"private": true,
"engines": {
"node": ">=18.17.1 <19.0.0"
Expand Down
1 change: 1 addition & 0 deletions src/webparts/blurb/BlurbWebPart.manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

"requiresCustomScript": false,
"supportedHosts": ["SharePointWebPart", "TeamsPersonalApp", "TeamsTab", "SharePointFullPage"],
"supportsFullBleed": true,
"supportsThemeVariants": true,

"preconfiguredEntries": [{
Expand Down
2 changes: 2 additions & 0 deletions src/webparts/blurb/BlurbWebPart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ export default class BlurbWebPart extends BaseClientSideWebPart<IBlurbWebPartPro
containers: this.properties.containers || [],
containerCount: this.properties.containerCount || 1,
isEditMode: this.displayMode === DisplayMode.Edit,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
isFullWidth: (this.context.manifest as any).supportedHosts?.includes('SharePointFullPage'),
displayMode: this.displayMode, // Pass display mode
onContainerClick: async (index: number) => {
if (this.displayMode === DisplayMode.Edit) {
Expand Down
21 changes: 16 additions & 5 deletions src/webparts/blurb/components/Blurb.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,18 @@
.containerGrid {
display: flex;
flex-wrap: wrap;
gap: 16px; // Spacing between containers
// gap: 12px; // Spacing between containers
justify-content: center;
justify-items: space-between;

.item {
flex: 1 1 min-content;
}

.container {
flex: 1 1 calc(25% - 16px); // Default: 4 containers per row
flex: 1 1; // Default: 4 containers per row
max-width: 200px; // Optional: Set a max width
min-width: 150px; // Ensures smaller containers on resize
min-width: 90px; // Ensures smaller containers on resize
position: relative;
margin: 10px;
padding: 20px;
Expand Down Expand Up @@ -74,16 +79,22 @@
display: block; /* Ensure the entire block is clickable */
}

.fullWidth {
width: 100%;
margin: 0 auto;
padding: 0;
}

// Responsiveness
@media (max-width: 1200px) {
.container {
flex: 1 1 calc(33.33% - 16px); // Adjusts to 3 containers per row
flex: 1 1 calc(33.33% - 12px); // Adjusts to 3 containers per row
}
}

@media (max-width: 768px) {
.container {
flex: 1 1 calc(50% - 16px); // Adjusts to 2 containers per row
flex: 1 1 calc(50% - 12px); // Adjusts to 2 containers per row
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/webparts/blurb/components/Blurb.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const Blurb: React.FunctionComponent<IBlurbProps> = (props) => {
};

return (
<div className={styles.blurbContainer}>
<div className={props.isFullWidth ? `${styles.blurbContainer} ${styles.fullWidth}` : styles.blurbContainer}>
<div className={styles.containerGrid}>
{props.containers.map((container, index) => {
const isSelected = selectedBlurbIndex === index;
Expand Down Expand Up @@ -122,7 +122,7 @@ export const Blurb: React.FunctionComponent<IBlurbProps> = (props) => {
/>
)}
<h3 style={{ color: container.fontColor }}>{container.title || 'Blurb Title'}</h3>
<p style={{ color: container.fontColor }}>{container.text || 'Add text'}</p>
<p style={{ color: container.fontColor }}>{container.text || ''}</p>
</WrapperElement>
);
})}
Expand Down
1 change: 1 addition & 0 deletions src/webparts/blurb/components/IBlurbProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export interface IBlurbProps {
containerCount: number;
isEditMode: boolean;
displayMode: DisplayMode;
isFullWidth?: boolean;
onContainerClick: (index: number) => void;
onEditClick: (index: number) => void;
onMoveClick: (index: number, direction: 'up' | 'down') => void; // Updated to include direction
Expand Down

0 comments on commit 6e64067

Please sign in to comment.