From 0283511112660e0cb773a6900fa408f23ac7e5e7 Mon Sep 17 00:00:00 2001 From: Danilo Woznica Date: Tue, 21 May 2019 15:35:42 +0100 Subject: [PATCH 1/4] feat(showcase): embed section --- .../Projects/Section/sections/Embed/index.tsx | 10 ++++++++++ .../Projects/Section/sections/Embed/styled.ts | 16 ++++++++++++++++ .../Projects/Section/sections/index.ts | 1 + src/components/Projects/Section/types.ts | 5 +++++ src/templates/project.tsx | 3 +++ 5 files changed, 35 insertions(+) create mode 100644 src/components/Projects/Section/sections/Embed/index.tsx create mode 100644 src/components/Projects/Section/sections/Embed/styled.ts diff --git a/src/components/Projects/Section/sections/Embed/index.tsx b/src/components/Projects/Section/sections/Embed/index.tsx new file mode 100644 index 00000000..31b207e3 --- /dev/null +++ b/src/components/Projects/Section/sections/Embed/index.tsx @@ -0,0 +1,10 @@ +import React from 'react' + +import { IEmbed } from '../../types' +import { Wrapper } from './styled' + +const Embed = (props: IEmbed) => { + return +} + +export default Embed diff --git a/src/components/Projects/Section/sections/Embed/styled.ts b/src/components/Projects/Section/sections/Embed/styled.ts new file mode 100644 index 00000000..ae905cef --- /dev/null +++ b/src/components/Projects/Section/sections/Embed/styled.ts @@ -0,0 +1,16 @@ +import styled from '@theme' + +export const Wrapper = styled.div` + position: relative; + padding-bottom: 56.25%; /* 16:9 */ + padding-top: 25px; + height: 0; + + iframe { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + } +` diff --git a/src/components/Projects/Section/sections/index.ts b/src/components/Projects/Section/sections/index.ts index 30cba1da..893920d2 100644 --- a/src/components/Projects/Section/sections/index.ts +++ b/src/components/Projects/Section/sections/index.ts @@ -10,3 +10,4 @@ export { default as waterfall } from './Waterfall' export { default as testimonial } from './Testimonial' export { default as sticky } from './Sticky' export { default as highlight } from './Highlight' +export { default as embed } from './Embed' diff --git a/src/components/Projects/Section/types.ts b/src/components/Projects/Section/types.ts index c8b3580f..ebd37e2c 100644 --- a/src/components/Projects/Section/types.ts +++ b/src/components/Projects/Section/types.ts @@ -111,6 +111,11 @@ export interface IStickyImage extends IStickyBase { export type ISticky = IStickyVideo | IStickyImage +// Embed +export interface IEmbed { + code: string +} + // Highlight export interface IHighlight { text: string diff --git a/src/templates/project.tsx b/src/templates/project.tsx index 74a57262..60d11365 100644 --- a/src/templates/project.tsx +++ b/src/templates/project.tsx @@ -322,6 +322,9 @@ export const query = graphql` # Highlight #text + + # Embed + code } } } From 8af59315d36746c9de75ea7571b8b9ff60302ece Mon Sep 17 00:00:00 2001 From: Danilo Woznica Date: Tue, 21 May 2019 15:42:24 +0100 Subject: [PATCH 2/4] fix(types): --- src/components/Projects/Section/types.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/components/Projects/Section/types.ts b/src/components/Projects/Section/types.ts index ebd37e2c..e79eeef2 100644 --- a/src/components/Projects/Section/types.ts +++ b/src/components/Projects/Section/types.ts @@ -133,6 +133,7 @@ export type sectionTypes = | 'testimonial' | 'sticky' | 'highlight' + | 'embed' export type SectionContent = | IText | IImage @@ -144,6 +145,7 @@ export type SectionContent = | ITestimonial | ISticky | IHighlight + | IEmbed export interface ISection { type: sectionTypes From b49d9f5cbe39a034142fc162a6c38168b07869b7 Mon Sep 17 00:00:00 2001 From: Danilo Woznica Date: Tue, 21 May 2019 15:52:35 +0100 Subject: [PATCH 3/4] fix(embed section): add default value --- src/components/Projects/Section/utils.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/Projects/Section/utils.ts b/src/components/Projects/Section/utils.ts index 24339e7e..096919b2 100644 --- a/src/components/Projects/Section/utils.ts +++ b/src/components/Projects/Section/utils.ts @@ -19,6 +19,7 @@ const defaultValues: { [K in sectionTypes]: layoutTypes } = { video: 'normal', waterfall: 'large', highlight: 'normal', + embed: 'normal', } const getProjectSectionWidth = (type: sectionTypes, layout?: layoutTypes) => { From 5103bfa704cae40c034d984fdc247214fad4e661 Mon Sep 17 00:00:00 2001 From: Danilo Woznica Date: Tue, 21 May 2019 16:05:09 +0100 Subject: [PATCH 4/4] fix(embed): removed unnecessary code --- src/components/Projects/Section/sections/Embed/styled.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/Projects/Section/sections/Embed/styled.ts b/src/components/Projects/Section/sections/Embed/styled.ts index ae905cef..42c9fa19 100644 --- a/src/components/Projects/Section/sections/Embed/styled.ts +++ b/src/components/Projects/Section/sections/Embed/styled.ts @@ -3,7 +3,6 @@ import styled from '@theme' export const Wrapper = styled.div` position: relative; padding-bottom: 56.25%; /* 16:9 */ - padding-top: 25px; height: 0; iframe {