Skip to content

Commit

Permalink
Merge pull request #17 from junyiacademy/feat/alignment
Browse files Browse the repository at this point in the history
Feat: Apply alignment style
  • Loading branch information
jiaojiaojiaoCpbr authored Apr 25, 2024
2 parents dfaffda + 552cd64 commit c0eff8f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@junyiacademy/perseus-core",
"version": "1.0.32",
"version": "1.0.33",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"license": "MIT",
Expand Down
10 changes: 8 additions & 2 deletions packages/perseus/src/widget-container.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ class WidgetContainer extends React.Component<Props, State> {
alignment = Widgets.getDefaultAlignment(type);
}

className += " widget-" + alignment;
const alignmentStyles = {
display: alignment,
};

const apiOptions = this.state.widgetProps.apiOptions;

Expand Down Expand Up @@ -135,7 +137,11 @@ class WidgetContainer extends React.Component<Props, State> {
return (
<div
className={className}
style={isStatic ? staticContainerStyles : {}}
style={
isStatic
? {...staticContainerStyles, ...alignmentStyles}
: alignmentStyles
}
>
<DependenciesContext.Consumer>
{({analytics}) => (
Expand Down

0 comments on commit c0eff8f

Please sign in to comment.