-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Layout] Add story with gutter (#40)
* upd Layout
- Loading branch information
ViZhe
authored
Jan 19, 2021
1 parent
720aab2
commit e664116
Showing
8 changed files
with
203 additions
and
45 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,9 @@ | ||
import Component from './src/QCol'; | ||
|
||
describe('QCol', () => { | ||
it('should match snapshot', async () => { | ||
const { element } = shallowMount(Component); | ||
|
||
expect(element).toMatchSnapshot(); | ||
}); | ||
}); |
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,7 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`QCol should match snapshot 1`] = ` | ||
<div | ||
class="q-col" | ||
/> | ||
`; |
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,9 @@ | ||
import Component from './src/QRow'; | ||
|
||
describe('QRow', () => { | ||
it('should match snapshot', async () => { | ||
const { element } = shallowMount(Component); | ||
|
||
expect(element).toMatchSnapshot(); | ||
}); | ||
}); |
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,7 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`QRow should match snapshot 1`] = ` | ||
<div | ||
class="q-row" | ||
/> | ||
`; |
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,115 @@ | ||
import QCol from '../../../src/qComponents/QCol'; | ||
import QRow from '../../../src/qComponents/QRow'; | ||
import './layout.scss'; | ||
|
||
export default { | ||
title: 'Components/Layout', | ||
subcomponents: { QRow, QCol }, | ||
argTypes: { | ||
gutter: { | ||
name: 'gutter', | ||
control: 'text', | ||
type: { name: 'string', required: false }, | ||
description: 'grid spacing (in CSS units)', | ||
table: { | ||
type: { | ||
summary: ['string'] | ||
} | ||
} | ||
} | ||
} | ||
}; | ||
|
||
export const QRowStory = (_, { argTypes }) => ({ | ||
props: Object.keys(argTypes), | ||
computed: { | ||
demoStyles() { | ||
return { | ||
'--layout-gutter': (this.gutter ?? '').trim() | ||
}; | ||
} | ||
}, | ||
template: ` | ||
<div class="demo" :style="demoStyles"> | ||
<q-row class="demo__row"> | ||
<q-col class="demo__col" cols="8"> | ||
<div class="demo__content">8</div> | ||
</q-col> | ||
<q-col class="demo__col" cols="4"> | ||
<div class="demo__content">4</div> | ||
</q-col> | ||
<q-col class="demo__col" cols="4"> | ||
<div class="demo__content">4</div> | ||
</q-col> | ||
<q-col class="demo__col" cols="4"> | ||
<div class="demo__content">4</div> | ||
</q-col> | ||
<q-col class="demo__col" cols="2"> | ||
<div class="demo__content">2</div> | ||
</q-col> | ||
<q-col class="demo__col" cols="2"> | ||
<div class="demo__content">2</div> | ||
</q-col> | ||
</q-row> | ||
<q-row class="demo__row"> | ||
<q-col class="demo__col" cols="2"> | ||
<div class="demo__content">2</div> | ||
</q-col> | ||
<q-col class="demo__col" cols="8"> | ||
<div class="demo__content">8</div> | ||
</q-col> | ||
<q-col class="demo__col" cols="2"> | ||
<div class="demo__content">2</div> | ||
</q-col> | ||
</q-row> | ||
<q-row class="demo__row"> | ||
<q-col class="demo__col" cols="2"> | ||
<div class="demo__content">2</div> | ||
</q-col> | ||
<q-col class="demo__col" cols="5"> | ||
<div class="demo__content">5</div> | ||
</q-col> | ||
<q-col class="demo__col" cols="2"> | ||
<div class="demo__content">2</div> | ||
</q-col> | ||
<q-col class="demo__col" cols="3"> | ||
<div class="demo__content">3</div> | ||
</q-col> | ||
</q-row> | ||
<q-row class="demo__row"> | ||
<q-col class="demo__col" cols="5"> | ||
<div class="demo__content">5</div> | ||
</q-col> | ||
<q-col class="demo__col" cols="7"> | ||
<div class="demo__content">7</div> | ||
</q-col> | ||
</q-row> | ||
<q-row class="demo__row"> | ||
<q-col class="demo__col" cols="10"> | ||
<div class="demo__content">10</div> | ||
</q-col> | ||
<q-col class="demo__col" cols="2"> | ||
<div class="demo__content">2</div> | ||
</q-col> | ||
</q-row> | ||
</div> | ||
` | ||
}); | ||
|
||
QRowStory.storyName = 'Default'; |
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
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
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 |
---|---|---|
@@ -1,14 +1,28 @@ | ||
.demo-row { | ||
width: 500px; | ||
min-height: 50px; | ||
background-color: var(--color-tertiary-gray); | ||
} | ||
.demo { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
width: 1000px; | ||
max-width: 100%; | ||
|
||
&__row { | ||
width: 100%; | ||
|
||
.demo-col { | ||
background-color: var(--color-tertiary-gray-ultra-darker); | ||
border-radius: var(--border-radius-base); | ||
&:nth-child(odd) { | ||
.demo__content { | ||
background-color: var(--color-primary-blue-light); | ||
} | ||
} | ||
} | ||
|
||
&:nth-child(odd) { | ||
background-color: var(--color-tertiary-gray-ultra-dark); | ||
&__content { | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
width: 100%; | ||
height: 50px; | ||
margin-bottom: var(--layout-gutter); | ||
background-color: var(--color-primary-blue-aqua); | ||
border-radius: var(--border-radius-base); | ||
} | ||
} |