Skip to content

Commit

Permalink
feat: template content justified bottom
Browse files Browse the repository at this point in the history
  • Loading branch information
peterpeterparker committed Feb 5, 2021
1 parent 9777a9c commit b546c21
Show file tree
Hide file tree
Showing 17 changed files with 60 additions and 34 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
- core: v8.1.2 ([CHANGELOG](https://github.com/deckgo/deckdeckgo/blob/master/webcomponents/core/CHANGELOG.md))
- highlight-code: v2.3.2 ([CHANGELOG](https://github.com/deckgo/deckdeckgo/blob/master/webcomponents/highlight-code/CHANGELOG.md))

### Web Components: Templates

- slide-content: v2.3.0 ([CHANGELOG](https://github.com/deckgo/deckdeckgo/blob/master/webcomponents/slides/content/CHANGELOG.md))

### Others

- cli: v2.1.1 ([CHANGELOG](https://github.com/deckgo/deckdeckgo/blob/master/cli/CHANGELOG.md))
Expand Down
19 changes: 10 additions & 9 deletions docs/docs/slides/app-slide-content/app-slide-content.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,14 +117,15 @@ This component offers the following options which could be set using attributes:

The following theming options will affect this component if set on its host or parent.

| CSS4 variable | Default | Note |
| ---------------------- | ------- | ------------------------------- |
| --background | | |
| --color | | |
| --slide-padding-top | 16px | Padding top of the all slide |
| --slide-padding-end | 32px | Padding right of the all slide |
| --slide-padding-bottom | 16px | Padding bottom of the all slide |
| --slide-padding-start | 32px | Padding left of the all slide |
| --zIndex | 1 | The z-index of the slide |
| CSS4 variable | Default | Note |
| ------------------------------- | ---------- | -------------------------------- |
| --background | | |
| --color | | |
| --slide-padding-top | 16px | Padding top of the all slide |
| --slide-padding-end | 32px | Padding right of the all slide |
| --slide-padding-bottom | 16px | Padding bottom of the all slide |
| --slide-padding-start | 32px | Padding left of the all slide |
| --slide-content-justify-content | flex-start | Justify the content of the slide |
| --zIndex | 1 | The z-index of the slide |

[deckdeckgo]: https://deckdeckgo.com
6 changes: 3 additions & 3 deletions docs/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"@deckdeckgo/slide-big-img": "^2.2.2",
"@deckdeckgo/slide-chart": "^2.2.2",
"@deckdeckgo/slide-code": "^3.1.2",
"@deckdeckgo/slide-content": "^2.2.2",
"@deckdeckgo/slide-content": "^2.3.0",
"@deckdeckgo/slide-countdown": "^2.2.2",
"@deckdeckgo/slide-gif": "^3.2.2",
"@deckdeckgo/slide-playground": "^2.2.2",
Expand Down
6 changes: 3 additions & 3 deletions remote/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion remote/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"@deckdeckgo/slide-big-img": "^2.2.2",
"@deckdeckgo/slide-chart": "^2.2.2",
"@deckdeckgo/slide-code": "^3.1.2",
"@deckdeckgo/slide-content": "^2.2.2",
"@deckdeckgo/slide-content": "^2.3.0",
"@deckdeckgo/slide-countdown": "^2.2.2",
"@deckdeckgo/slide-gif": "^3.2.2",
"@deckdeckgo/slide-playground": "^2.2.2",
Expand Down
6 changes: 3 additions & 3 deletions studio/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion studio/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"@deckdeckgo/slide-aspect-ratio": "^3.2.2",
"@deckdeckgo/slide-author": "^2.2.2",
"@deckdeckgo/slide-chart": "^2.2.2",
"@deckdeckgo/slide-content": "^2.2.2",
"@deckdeckgo/slide-content": "^2.3.0",
"@deckdeckgo/slide-gif": "^3.2.2",
"@deckdeckgo/slide-playground": "^2.2.2",
"@deckdeckgo/slide-poll": "^2.2.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ export class AppTemplatesDefault {
return (
<Fragment>
{this.renderTitle()}

{this.renderContent()}

{this.renderSplit()}
Expand Down Expand Up @@ -120,7 +121,17 @@ export class AppTemplatesDefault {
}

private renderContent() {
return <app-templates-content custom-tappable onClick={() => this.composeTemplate.emit({template: SlideTemplate.CONTENT})}></app-templates-content>;
const flexEndStyle = {'--slide-content-justify-content': 'flex-end'};

return (
<Fragment>
<app-templates-content custom-tappable onClick={() => this.composeTemplate.emit({template: SlideTemplate.CONTENT})}></app-templates-content>
<app-templates-content
custom-tappable
onClick={() => this.composeTemplate.emit({template: SlideTemplate.CONTENT, style: flexEndStyle})}
style={flexEndStyle}></app-templates-content>
</Fragment>
);
}

private renderSplit() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,14 @@ app-create-slide {
}

div.item {
min-height: 7rem;
height: fit-content;
overflow: hidden;

background: white;

@include editor.panel;

--slide-width: 100%;
--slide-height: 7rem;

deckgo-slide-title,
deckgo-slide-content,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ export class AppCreateSlide {

@Event() signIn: EventEmitter<void>;

private async addSlide(template: SlideTemplate, deck?: Deck, elements?: SlotType[]) {
const slide: JSX.IntrinsicElements = await CreateSlidesUtils.createSlide({template, elements}, deck);
private async addSlide(template: SlideTemplate, deck?: Deck, elements?: SlotType[], style?: {[key: string]: string}) {
const slide: JSX.IntrinsicElements = await CreateSlidesUtils.createSlide({template, elements, style}, deck);
await this.closePopover(template, slide);
}

Expand Down Expand Up @@ -137,7 +137,7 @@ export class AppCreateSlide {
if (this.composeTemplate.template === SlideTemplate.SPLIT) {
await this.addSlideSplit(SlideTemplate.SPLIT, this.composeTemplate.attributes, elements);
} else if (this.composeTemplate.template === SlideTemplate.CONTENT) {
await this.addSlide(SlideTemplate.CONTENT, undefined, elements);
await this.addSlide(SlideTemplate.CONTENT, undefined, elements, this.composeTemplate.style);
} else if (this.composeTemplate.scope === SlideScope.USER) {
await this.addRestrictedSlide(this.composeTemplate.template, SlideScope.USER, elements);
} else if (this.composeTemplate.scope === SlideScope.COMMUNITY) {
Expand Down Expand Up @@ -315,7 +315,9 @@ export class AppCreateSlide {
};

if (slideTemplate === SlideTemplate.CONTENT) {
return <app-templates-content highlight={true} highlightIndex={this.elements?.length} {...attr}></app-templates-content>;
return (
<app-templates-content highlight={true} highlightIndex={this.elements?.length} {...attr} style={this.composeTemplate.style}></app-templates-content>
);
} else if (slideTemplate === SlideTemplate.SPLIT) {
return <app-templates-split vertical={this.composeTemplate.attributes !== undefined} {...attr}></app-templates-split>;
} else if (SlideUtils.isSlideTemplate(this.composeTemplate.scope)) {
Expand Down
7 changes: 4 additions & 3 deletions studio/src/app/utils/editor/create-slides.utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export interface InitTemplate {
scope?: SlideScope;
elements?: SlotType[];
attributes?: SlideAttributes;
style?: {[key: string]: string};
}

export class CreateSlidesUtils {
Expand All @@ -39,7 +40,7 @@ export class CreateSlidesUtils {

private static async createSlideDefault(template: InitTemplate, deck?: Deck): Promise<JSX.IntrinsicElements> {
if (template.template === SlideTemplate.CONTENT) {
return this.createSlideContent(template.elements);
return this.createSlideContent(template.elements, template.style);
} else if (template.template === SlideTemplate.SPLIT) {
return this.createSlideSplit(template.elements);
} else if (template.template === SlideTemplate.GIF) {
Expand Down Expand Up @@ -81,15 +82,15 @@ export class CreateSlidesUtils {
});
}

private static createSlideContent(elements: SlotType[]): Promise<JSX.IntrinsicElements | undefined> {
private static createSlideContent(elements: SlotType[], style?: {[key: string]: string}): Promise<JSX.IntrinsicElements | undefined> {
return new Promise<JSX.IntrinsicElements>((resolve) => {
if (!elements || elements.length < 1) {
resolve(undefined);
return;
}

const slide: JSX.IntrinsicElements = (
<deckgo-slide-content key={uuid()}>
<deckgo-slide-content key={uuid()} style={style}>
{this.createElement(elements[0], 'title')}
{elements.length >= 2 ? this.createElement(elements[1], 'content') : undefined}
</deckgo-slide-content>
Expand Down
6 changes: 6 additions & 0 deletions webcomponents/slides/content/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# 2.3.0 (2021-02-05)

### Style

- new style `--slide-content-justify-content` to align content to bottom

# 2.2.2 (2020-11-14)

### Fix
Expand Down
2 changes: 1 addition & 1 deletion webcomponents/slides/content/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion webcomponents/slides/content/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@deckdeckgo/slide-content",
"version": "2.2.2",
"version": "2.3.0",
"description": "The Content template is a simple slide which display a title and content aligned to the start of the page of the presentation",
"main": "dist/index.cjs.js",
"module": "dist/index.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
div.deckgo-slide {
flex-direction: column;
align-items: flex-start;
justify-content: flex-start;
justify-content: var(--slide-content-justify-content, flex-start);
}

::slotted([slot="title"]),
Expand Down
2 changes: 2 additions & 0 deletions webcomponents/slides/content/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

<script type="module" src="https://unpkg.com/@deckdeckgo/core@latest/dist/deckdeckgo/deckdeckgo.esm.js"></script>

<script type="module" src="https://unpkg.com/@deckdeckgo/reveal@latest/dist/deckdeckgo-reveal/deckdeckgo-reveal.esm.js"></script>

<style>
* {
box-sizing: border-box;
Expand Down

0 comments on commit b546c21

Please sign in to comment.