add 'full-width' class on Flex-Layout

This commit is contained in:
2021-09-08 11:40:21 +09:00
parent 898dcbc313
commit c7cffc1fb8
11 changed files with 84 additions and 27 deletions

42
dist/main.js vendored

File diff suppressed because one or more lines are too long

BIN
logo.gvdesign Normal file

Binary file not shown.

1
logo.svg Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 5.4 KiB

View File

@@ -46,7 +46,6 @@
"watch": "webpack --watch",
"serve": "webpack serve",
"storybook": "start-storybook -p 6006",
"build-storybook": "build-storybook",
"publish": "yarn publish"
"build-storybook": "build-storybook"
}
}

6
src/_mixins.scss Normal file
View File

@@ -0,0 +1,6 @@
@mixin shadow($i) {
//box-shadow: 0 #{$i*1.25}px #{$i*1.2}px #{$i*0.2}px $default-shadow-color;
box-shadow: 0 #{$i}px #{$i}px 0 rgba(0, 0, 0, 0.14),
0 #{$i * 1.5}px #{$i/2}px -#{$i}px rgba(0, 0, 0, 0.2),
0 #{$i/2}px #{$i * 2.5}px 0 rgba(0, 0, 0, 0.12);
}

24
src/_utils.scss Normal file
View File

@@ -0,0 +1,24 @@
.text-left {
text-align: left;
text-align: start;
}
.text-right {
text-align: right;
text-align: end;
}
.text-center {
text-align: center;
}
.text-justify {
text-align: justify;
}
.hidden {
display: none !important;
}
@for $i from 1 through 12 {
.shadow-#{$i} {
@include shadow($i);
}
}

View File

@@ -9,7 +9,8 @@ import {Variables, Colors} from './variables';
@customElement('persona-button')
export class Button extends LitElement {
static styles = css `
static styles = [
css `
:host {
}
@@ -36,7 +37,7 @@ export class Button extends LitElement {
button.raised{
}
`;
`];
@property({type:Boolean})
primary? = false;

View File

@@ -1,5 +1,6 @@
import { Story, Meta } from '@storybook/web-components';
import {LitElement, html, css,} from 'lit';
import {classMap} from 'lit/directives/class-map.js';
import './flowlayout';
@@ -7,14 +8,14 @@ export default {
title: 'Persona/FlowLayout',
component: 'persona-flow-layout',
argTypes: {
//heading: { control: 'text',
//description: 'Title of the page.' },
fullWidth: {control: 'boolean',
description: "add a 'full-width' class."}
},
} as Meta;
const Template:Story = () => html`
<persona-flow-layout>
const Template:Story = ({fullWidth}) => html`
<persona-flow-layout class=${classMap({'full-width':fullWidth})}>
<div style="background-color:red">1</div>
<div data-width="2" style="background-color:green">2</div>
<div style="background-color:blue">1</div>
@@ -25,6 +26,8 @@ const Template:Story = () => html`
export const Basic = Template.bind({});
Basic.args = {
//heading: 'AppBar Title',
};
export const FullWidth = Template.bind({});
FullWidth.args = {
fullWidth: true
};

View File

@@ -1,5 +1,7 @@
import {LitElement, html, css} from 'lit';
import {customElement, property} from 'lit/decorators.js';
import {classMap} from 'lit/directives/class-map.js';
import {Variables} from './variables';
@@ -8,6 +10,8 @@ import {Variables} from './variables';
*/
@customElement('persona-flow-layout')
export class FlowLayout extends LitElement {
@property({type:Boolean})
fullWidth? = false;
static styles = css`
:host{
@@ -16,6 +20,11 @@ export class FlowLayout extends LitElement {
display: flex;
flex-flow: row;
flex-wrap: wrap;
max-width: ${Variables.breakPointDesktop}px
}
:host(.full-width){
padding:0;
max-width:inherit;
}
::slotted(*){
width: 100%;

View File

@@ -23,3 +23,6 @@ p {
h1 {
color: yellow !important;
}
@import "./mixins";
@import "./utils";

View File

@@ -5,6 +5,7 @@ export const Variables = {
navWidth: 240,
breakPointMobile: 600,
breakPointTablet: 950,
breakPointDesktop: 1024
};
export const Colors = {