Skip to content

Commit

Permalink
Merge pull request #89 from Significa/showcase-embed
Browse files Browse the repository at this point in the history
feat(showcase): embed section
  • Loading branch information
Pedro Brandão authored May 21, 2019
2 parents dfb2867 + 5103bfa commit 256cdef
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/components/Projects/Section/sections/Embed/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import React from 'react'

import { IEmbed } from '../../types'
import { Wrapper } from './styled'

const Embed = (props: IEmbed) => {
return <Wrapper dangerouslySetInnerHTML={{ __html: props.code }} />
}

export default Embed
15 changes: 15 additions & 0 deletions src/components/Projects/Section/sections/Embed/styled.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import styled from '@theme'

export const Wrapper = styled.div`
position: relative;
padding-bottom: 56.25%; /* 16:9 */
height: 0;
iframe {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
`
1 change: 1 addition & 0 deletions src/components/Projects/Section/sections/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
7 changes: 7 additions & 0 deletions src/components/Projects/Section/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -128,6 +133,7 @@ export type sectionTypes =
| 'testimonial'
| 'sticky'
| 'highlight'
| 'embed'
export type SectionContent =
| IText
| IImage
Expand All @@ -139,6 +145,7 @@ export type SectionContent =
| ITestimonial
| ISticky
| IHighlight
| IEmbed

export interface ISection {
type: sectionTypes
Expand Down
1 change: 1 addition & 0 deletions src/components/Projects/Section/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const defaultValues: { [K in sectionTypes]: layoutTypes } = {
video: 'normal',
waterfall: 'large',
highlight: 'normal',
embed: 'normal',
}

const getProjectSectionWidth = (type: sectionTypes, layout?: layoutTypes) => {
Expand Down
3 changes: 3 additions & 0 deletions src/templates/project.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,9 @@ export const query = graphql`
# Highlight
#text
# Embed
code
}
}
}
Expand Down

0 comments on commit 256cdef

Please sign in to comment.