forked from mainmatter/mainmatter.com
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New work page layout (mainmatter#333)
* Work: Shape for cases * Use spaces over tabs, add editorconfig
- Loading branch information
Showing
6 changed files
with
239 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# http://editorconfig.org | ||
|
||
root = true | ||
|
||
[*] | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
[*.hbs] | ||
insert_final_newline = false | ||
|
||
[*.{diff,md}] | ||
trim_trailing_whitespace = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import hbs from '@glimmer/inline-precompile'; | ||
import { render, setupRenderingTest } from '@glimmer/test-helpers'; | ||
|
||
const { module, test } = QUnit; | ||
|
||
module('Component: ShapeCase', function (hooks) { | ||
setupRenderingTest(hooks); | ||
|
||
test('it renders', async function (assert) { | ||
/* | ||
* You may pass data into the component through arguments set on the | ||
* `testContext` | ||
* | ||
* For example: | ||
* | ||
* ``` | ||
* this.foo = { foo: '123' }; | ||
* | ||
* await render(hbs`<ShapeCase @foo={{this.foo}} />`) | ||
* | ||
* // or | ||
* | ||
* this.foo = 'bar'; | ||
* await render(hbs`<p>{{this.foo}}</p>`); | ||
* | ||
* assert.dom('p').text('bar'); | ||
* ``` | ||
*/ | ||
await render(hbs`<ShapeCase />`); | ||
assert.ok(this.containerElement.querySelector('div')); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import Component from '@glimmer/component'; | ||
|
||
export default class ShapeCase extends Component { | ||
public clipId = Math.random().toString(36).substr(2, 5); | ||
|
||
get imageClipStyle() { | ||
const shouldClip = this.args.clipImage || true; | ||
|
||
if (!shouldClip) { | ||
return ''; | ||
} | ||
|
||
return `clip-path: url(#${this.clipId});`; | ||
} | ||
|
||
get shapeStyle() { | ||
return `fill: ${this.args.color || '#007DF6'}` | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
@block typography from "../../styles/blocks/typography.block.css"; | ||
|
||
:scope { | ||
position: relative; | ||
} | ||
|
||
.shape { | ||
display: block; | ||
position: relative; | ||
left: 50%; | ||
transform: translate(-50%); | ||
width: 100vw; | ||
height: auto; | ||
margin: -8rem 0 6rem; | ||
} | ||
|
||
.logo { | ||
position: absolute; | ||
top: calc(50vw - 12rem); | ||
} | ||
|
||
.logo-img { | ||
display: block; | ||
height: 4rem; | ||
width: auto; | ||
} | ||
|
||
.floating { | ||
position: absolute; | ||
top: 13rem; | ||
left: 50%; | ||
transform: translate(22rem); | ||
} | ||
|
||
.floating-background { | ||
fill: var(--link-color); | ||
} | ||
|
||
.floating-content { | ||
position: absolute; | ||
top: calc(50% - 21rem); | ||
right: calc(-56.5rem + 100vw); | ||
width: 25rem; | ||
transform: translate(-50%); | ||
text-align: right; | ||
|
||
--link-color: #fff; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<figure> | ||
<svg class="shape" height="900" viewBox="0 0 1800 900" width="1800" xmlns="http://www.w3.org/2000/svg"> | ||
<defs> | ||
<clipPath id={{this.clipId}}> | ||
<path | ||
d="m840.577137 0 862.961153 498.230855-231.96152 401.769145h-512.153907l-862.9611537-498.230855 231.9615247-401.769145z" | ||
fill-rule="evenodd" | ||
></path> | ||
</clipPath> | ||
</defs> | ||
<g style="clip-path: url(#{{this.clipId}});"> | ||
<rect x="0" y="0" width="100%" height="100%" style={{this.shapeStyle}}></rect> | ||
</g> | ||
{{#if @image}} | ||
<g style={{this.imageClipStyle}}> | ||
<image x="0" y="0" xlink:href="{{@image}}" width="100%" height="100%"></image> | ||
</g> | ||
{{/if}} | ||
</svg> | ||
<figcaption> | ||
<div class="floating"> | ||
<svg class="shape" height="900" viewBox="0 0 1800 900" width="1800" xmlns="http://www.w3.org/2000/svg"> | ||
<path | ||
d="m840.577137 0 862.961153 498.230855-231.96152 401.769145h-512.153907l-862.9611537-498.230855 231.9615247-401.769145z" | ||
fill-rule="evenodd" | ||
class="floating-background" | ||
></path> | ||
</svg> | ||
<div class="floating-content"> | ||
<a href="{{@link}}" data-internal> | ||
{{if @linkLabel @linkLabel 'Read Case Study'}} | ||
</a> | ||
</div> | ||
</div> | ||
{{#if @logo}} | ||
<div class="logo"> | ||
<img class="logo-img" src="{{@logo}}" alt="" /> | ||
</div> | ||
{{/if}} | ||
{{yield}} | ||
</figcaption> | ||
</figure> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters