feat: estiloak sortzen ditu
This commit is contained in:
21
front/src/components/Container.tsx
Normal file
21
front/src/components/Container.tsx
Normal file
@@ -0,0 +1,21 @@
|
||||
import { rem } from 'polished';
|
||||
import styled from 'styled-components';
|
||||
import { media } from '../ui/theme/media';
|
||||
import { size } from '../ui/theme/size';
|
||||
|
||||
export const Container = styled.div`
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
padding-left: ${rem(size.tiny)};
|
||||
padding-right: ${rem(size.tiny)};
|
||||
|
||||
width: 100%;
|
||||
|
||||
${media.tablet`
|
||||
width: 744px;
|
||||
`}
|
||||
|
||||
${media.desktop`
|
||||
width: 1014px;
|
||||
`}
|
||||
`;
|
||||
@@ -1,5 +1,10 @@
|
||||
import { graphql, PageProps, useStaticQuery } from 'gatsby';
|
||||
import { rem } from 'polished';
|
||||
import React from 'react';
|
||||
import styled from 'styled-components';
|
||||
import { Container } from '../components/Container';
|
||||
import { GlobalStyles } from '../ui/GlobalStyles';
|
||||
import { font, media, size } from '../ui/theme';
|
||||
|
||||
interface DataProps {
|
||||
strapiHasiera: {
|
||||
@@ -12,7 +17,7 @@ interface DataProps {
|
||||
};
|
||||
}
|
||||
|
||||
const IndexPage: React.VFC<PageProps<DataProps>> = () => {
|
||||
const IndexPage: React.VFC<PageProps> = () => {
|
||||
const { strapiHasiera } = useStaticQuery<DataProps>(graphql`
|
||||
{
|
||||
strapiHasiera {
|
||||
@@ -27,11 +32,77 @@ const IndexPage: React.VFC<PageProps<DataProps>> = () => {
|
||||
`);
|
||||
|
||||
return (
|
||||
<main>
|
||||
<h1>{strapiHasiera.data.attributes.izenburua}</h1>
|
||||
<p>{strapiHasiera.data.attributes.deskribapena}</p>
|
||||
</main>
|
||||
<>
|
||||
<GlobalStyles />
|
||||
|
||||
<Gainburua>
|
||||
<div>LABA LOGOA</div>
|
||||
|
||||
<Helbidea>
|
||||
<p>Gazteluko plaza 2</p>
|
||||
<p>Iruñea</p>
|
||||
</Helbidea>
|
||||
</Gainburua>
|
||||
|
||||
<Container>
|
||||
<main>
|
||||
<Deskribapena>
|
||||
{strapiHasiera.data.attributes.deskribapena}
|
||||
</Deskribapena>
|
||||
|
||||
<IzenburuWrapper>
|
||||
<Marra />
|
||||
<Izenburua>{strapiHasiera.data.attributes.izenburua}</Izenburua>
|
||||
</IzenburuWrapper>
|
||||
</main>
|
||||
</Container>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
const Helbidea = styled.div`
|
||||
border-right: 3px solid white;
|
||||
padding-right: ${rem(size.small)};
|
||||
${font.small()};
|
||||
`;
|
||||
|
||||
const Gainburua = styled.header`
|
||||
padding: ${rem(size.base)};
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin-bottom: ${rem(size.base)};
|
||||
|
||||
${media.tablet`
|
||||
padding: ${rem(size.large)};
|
||||
`};
|
||||
`;
|
||||
|
||||
const Deskribapena = styled.p`
|
||||
margin-bottom: ${rem(size.xlarge)};
|
||||
|
||||
text-align: justify;
|
||||
|
||||
${font.large()};
|
||||
`;
|
||||
|
||||
const IzenburuWrapper = styled.div`
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
`;
|
||||
|
||||
const Marra = styled.hr`
|
||||
flex-grow: 1;
|
||||
border: none;
|
||||
box-shadow: inset 0px -3px 0px 0px white;
|
||||
margin-right: ${rem(size.tiny)};
|
||||
`;
|
||||
|
||||
const Izenburua = styled.h1`
|
||||
text-transform: uppercase;
|
||||
text-align: right;
|
||||
vertical-align: bottom;
|
||||
|
||||
${font.gargantuan()};
|
||||
`;
|
||||
|
||||
export default IndexPage;
|
||||
|
||||
208
front/src/ui/GlobalStyles.tsx
Normal file
208
front/src/ui/GlobalStyles.tsx
Normal file
@@ -0,0 +1,208 @@
|
||||
import { createGlobalStyle, css } from 'styled-components';
|
||||
import { font } from './theme';
|
||||
|
||||
/**
|
||||
* Inicializa estilos base
|
||||
* 1. Change from `box-sizing: content-box` so that `width` is not affected
|
||||
* by `padding` or `border`.
|
||||
* 2. As a best practice, apply a default 'background-color'.
|
||||
* 3. Set an explicit initial text-align value so that we can later use the the 'inherit'
|
||||
* value on things like '<th>' elements.
|
||||
* 4. Prevent adjustments of font size after orientation changes in IE on
|
||||
* Windows Phone and in iOS.
|
||||
* 5. Setting @viewport causes scrollbars to overlap content in IE11 and Edge,
|
||||
* so we force a non-overlapping, non-auto-hiding scrollbar to counteract.
|
||||
* 6. Change the default tap highlight to be completely transparent in iOS.
|
||||
* 7. Implement full height to let children control own height.
|
||||
*/
|
||||
const reboot = css`
|
||||
*,
|
||||
*::before,
|
||||
*::after {
|
||||
box-sizing: border-box; /* 1 */
|
||||
}
|
||||
html {
|
||||
-webkit-text-size-adjust: 100%; /* 4 */
|
||||
-ms-text-size-adjust: 100%; /* 4 */
|
||||
-ms-overflow-style: scrollbar; /* 5 */
|
||||
-webkit-tap-highlight-color: rgba(#000, 0); /* 6 */
|
||||
-webkit-tap-highlight-color: transparent;
|
||||
}
|
||||
body {
|
||||
min-height: 100vh;
|
||||
}
|
||||
-ms-viewport {
|
||||
width: device-width;
|
||||
}
|
||||
strong {
|
||||
font-weight: 700;
|
||||
}
|
||||
`;
|
||||
|
||||
const reset = css`
|
||||
/* http://meyerweb.com/eric/tools/css/reset/
|
||||
v4.0 | 20180602
|
||||
License: none (public domain)
|
||||
*/
|
||||
html,
|
||||
body,
|
||||
div,
|
||||
span,
|
||||
applet,
|
||||
object,
|
||||
iframe,
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
h4,
|
||||
h5,
|
||||
h6,
|
||||
p,
|
||||
blockquote,
|
||||
pre,
|
||||
a,
|
||||
abbr,
|
||||
acronym,
|
||||
address,
|
||||
big,
|
||||
cite,
|
||||
code,
|
||||
del,
|
||||
dfn,
|
||||
img,
|
||||
ins,
|
||||
kbd,
|
||||
q,
|
||||
s,
|
||||
samp,
|
||||
small,
|
||||
strike,
|
||||
strong,
|
||||
sub,
|
||||
sup,
|
||||
tt,
|
||||
var,
|
||||
u,
|
||||
center,
|
||||
dl,
|
||||
dt,
|
||||
dd,
|
||||
ol,
|
||||
ul,
|
||||
li,
|
||||
fieldset,
|
||||
form,
|
||||
label,
|
||||
legend,
|
||||
table,
|
||||
caption,
|
||||
tbody,
|
||||
tfoot,
|
||||
thead,
|
||||
tr,
|
||||
th,
|
||||
td,
|
||||
article,
|
||||
aside,
|
||||
canvas,
|
||||
details,
|
||||
embed,
|
||||
figure,
|
||||
figcaption,
|
||||
footer,
|
||||
header,
|
||||
hgroup,
|
||||
main,
|
||||
menu,
|
||||
nav,
|
||||
output,
|
||||
ruby,
|
||||
section,
|
||||
summary,
|
||||
time,
|
||||
mark,
|
||||
audio,
|
||||
video {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
font-size: 100%;
|
||||
font: inherit;
|
||||
vertical-align: baseline;
|
||||
}
|
||||
em,
|
||||
i,
|
||||
b {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
font-size: 100%;
|
||||
vertical-align: baseline;
|
||||
}
|
||||
/* HTML5 display-role reset for older browsers */
|
||||
article,
|
||||
aside,
|
||||
details,
|
||||
figcaption,
|
||||
figure,
|
||||
footer,
|
||||
header,
|
||||
hgroup,
|
||||
main,
|
||||
menu,
|
||||
nav,
|
||||
section {
|
||||
display: block;
|
||||
}
|
||||
*:focus,
|
||||
:active {
|
||||
outline: 0;
|
||||
}
|
||||
/* HTML5 hidden-attribute fix for newer browsers */
|
||||
*[hidden] {
|
||||
display: none;
|
||||
}
|
||||
body {
|
||||
line-height: 1;
|
||||
}
|
||||
ol,
|
||||
ul {
|
||||
list-style: none;
|
||||
}
|
||||
blockquote,
|
||||
q {
|
||||
quotes: none;
|
||||
}
|
||||
blockquote:before,
|
||||
blockquote:after,
|
||||
q:before,
|
||||
q:after {
|
||||
content: '';
|
||||
content: none;
|
||||
}
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
border-spacing: 0;
|
||||
}
|
||||
a:link,
|
||||
a:visited,
|
||||
a:active {
|
||||
text-decoration: none;
|
||||
color: inherit;
|
||||
}
|
||||
`;
|
||||
|
||||
export const GlobalStyles = createGlobalStyle`
|
||||
${reset};
|
||||
${reboot};
|
||||
|
||||
body {
|
||||
font-family: 'Arial', 'Open Sans', sans-serif;
|
||||
|
||||
${font.base()}
|
||||
font-weight: 700;
|
||||
|
||||
background-color: #fd3447;
|
||||
color: #fff;
|
||||
}
|
||||
`;
|
||||
4
front/src/ui/theme/breakpoints.ts
Normal file
4
front/src/ui/theme/breakpoints.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
export const breakpoints = {
|
||||
tablet: 768,
|
||||
desktop: 1024,
|
||||
};
|
||||
41
front/src/ui/theme/font.ts
Normal file
41
front/src/ui/theme/font.ts
Normal file
@@ -0,0 +1,41 @@
|
||||
import { css } from 'styled-components';
|
||||
import { rem } from 'polished';
|
||||
|
||||
export const font = {
|
||||
tiny() {
|
||||
return css`
|
||||
font-size: ${rem(12.64)};
|
||||
line-height: ${rem(17)};
|
||||
`;
|
||||
},
|
||||
small() {
|
||||
return css`
|
||||
font-size: ${rem(16)};
|
||||
line-height: ${rem(22)};
|
||||
`;
|
||||
},
|
||||
base() {
|
||||
return css`
|
||||
font-size: ${rem(18)};
|
||||
line-height: ${rem(24)};
|
||||
`;
|
||||
},
|
||||
large() {
|
||||
return css`
|
||||
font-size: ${rem(25.63)};
|
||||
line-height: ${rem(35)};
|
||||
`;
|
||||
},
|
||||
huge() {
|
||||
return css`
|
||||
font-size: ${rem(36.41)};
|
||||
line-height: ${rem(50)};
|
||||
`;
|
||||
},
|
||||
gargantuan() {
|
||||
return css`
|
||||
font-size: ${rem(41.83)};
|
||||
line-height: ${rem(57)};
|
||||
`;
|
||||
},
|
||||
};
|
||||
4
front/src/ui/theme/index.ts
Normal file
4
front/src/ui/theme/index.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
export { breakpoints } from './breakpoints';
|
||||
export { font } from './font';
|
||||
export { media } from './media';
|
||||
export { size } from './size';
|
||||
15
front/src/ui/theme/media.ts
Normal file
15
front/src/ui/theme/media.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { css } from 'styled-components';
|
||||
import { breakpoints } from './breakpoints';
|
||||
|
||||
export const media = {
|
||||
tablet: (styles: TemplateStringsArray, ...args) => css`
|
||||
@media (min-width: ${breakpoints.tablet}px) {
|
||||
${css(styles, ...args)};
|
||||
}
|
||||
`,
|
||||
desktop: (styles: TemplateStringsArray, ...args) => css`
|
||||
@media (min-width: ${breakpoints.desktop}px) {
|
||||
${css(styles, ...args)};
|
||||
}
|
||||
`,
|
||||
};
|
||||
12
front/src/ui/theme/size.ts
Normal file
12
front/src/ui/theme/size.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
export const size = {
|
||||
none: 0,
|
||||
xtiny: 4,
|
||||
tiny: 8,
|
||||
small: 12,
|
||||
mini: 16,
|
||||
base: 24,
|
||||
medium: 32,
|
||||
large: 48,
|
||||
xlarge: 64,
|
||||
huge: 96,
|
||||
};
|
||||
Reference in New Issue
Block a user