mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-15 01:52:42 +03:00
launch: more design fixes
This commit is contained in:
parent
3be77c9d87
commit
a20c43d93b
@ -13,7 +13,7 @@ export const foregroundFromBackground = (background) => {
|
|||||||
return ((whiteBrightness - brightness) < 50) ? 'black' : 'white';
|
return ((whiteBrightness - brightness) < 50) ? 'black' : 'white';
|
||||||
}
|
}
|
||||||
|
|
||||||
export const Sigil = memo(({ classes = '', color, ship, size, svgClass = '' }) => {
|
export const Sigil = memo(({ classes = '', color, ship, size, svgClass = '', icon = false }) => {
|
||||||
return ship.length > 14
|
return ship.length > 14
|
||||||
? (<div
|
? (<div
|
||||||
className={'bg-black dib ' + classes}
|
className={'bg-black dib ' + classes}
|
||||||
@ -27,6 +27,7 @@ export const Sigil = memo(({ classes = '', color, ship, size, svgClass = '' }) =
|
|||||||
patp: ship,
|
patp: ship,
|
||||||
renderer: reactRenderer,
|
renderer: reactRenderer,
|
||||||
size: size,
|
size: size,
|
||||||
|
icon,
|
||||||
colors: [
|
colors: [
|
||||||
color,
|
color,
|
||||||
foregroundFromBackground(color)
|
foregroundFromBackground(color)
|
||||||
@ -36,4 +37,4 @@ export const Sigil = memo(({ classes = '', color, ship, size, svgClass = '' }) =
|
|||||||
</div>)
|
</div>)
|
||||||
})
|
})
|
||||||
|
|
||||||
export default Sigil;
|
export default Sigil;
|
||||||
|
@ -2,6 +2,21 @@ import _ from 'lodash';
|
|||||||
|
|
||||||
export const MOBILE_BROWSER_REGEX = /Android|webOS|iPhone|iPad|iPod|BlackBerry/i;
|
export const MOBILE_BROWSER_REGEX = /Android|webOS|iPhone|iPad|iPod|BlackBerry/i;
|
||||||
|
|
||||||
|
export function clamp(x,min,max) {
|
||||||
|
return Math.max(min, Math.min(max, x));
|
||||||
|
}
|
||||||
|
|
||||||
|
// color is a #000000 color
|
||||||
|
export function adjustHex(color, amount) {
|
||||||
|
const res = _.chain(color.slice(1))
|
||||||
|
.split('').chunk(2) // get individual color channels
|
||||||
|
.map(c => parseInt(c.join(''), 16)) // as hex
|
||||||
|
.map(c => clamp(c + amount, 0, 255).toString(16)) // adjust
|
||||||
|
.join('').value();
|
||||||
|
return `#${res}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
export function resourceAsPath(resource) {
|
export function resourceAsPath(resource) {
|
||||||
const { name, ship } = resource;
|
const { name, ship } = resource;
|
||||||
return `/ship/~${ship}/${name}`;
|
return `/ship/~${ship}/${name}`;
|
||||||
|
@ -3,7 +3,7 @@ import Helmet from 'react-helmet';
|
|||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
|
|
||||||
import { Box, Row, Icon, Text, Center } from '@tlon/indigo-react';
|
import { Box, Row, Icon, Text, Center } from '@tlon/indigo-react';
|
||||||
import { uxToHex } from "~/logic/lib/util";
|
import { uxToHex, adjustHex } from "~/logic/lib/util";
|
||||||
|
|
||||||
import './css/custom.css';
|
import './css/custom.css';
|
||||||
|
|
||||||
@ -62,6 +62,7 @@ export default class LaunchApp extends React.Component {
|
|||||||
</Row>
|
</Row>
|
||||||
</Tile>
|
</Tile>
|
||||||
<Tile
|
<Tile
|
||||||
|
borderColor={adjustHex(sigilColor, -40)}
|
||||||
bg={sigilColor}
|
bg={sigilColor}
|
||||||
to="/~profile"
|
to="/~profile"
|
||||||
>
|
>
|
||||||
|
@ -26,9 +26,6 @@ if (dark.matches) {
|
|||||||
function darkColors(dark) {
|
function darkColors(dark) {
|
||||||
if (dark.matches) {
|
if (dark.matches) {
|
||||||
text = '#7f7f7f';
|
text = '#7f7f7f';
|
||||||
background = '#333';
|
|
||||||
} else {
|
|
||||||
text = '#000000';
|
|
||||||
background = '#ffffff';
|
background = '#ffffff';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -375,7 +372,7 @@ export default class ClockTile extends React.Component {
|
|||||||
|
|
||||||
renderWrapper(child) {
|
renderWrapper(child) {
|
||||||
return (
|
return (
|
||||||
<Tile p={0} bg="transparent" border={0}>
|
<Tile p={0} border={0}>
|
||||||
{child}
|
{child}
|
||||||
</Tile>
|
</Tile>
|
||||||
);
|
);
|
||||||
|
@ -3,6 +3,7 @@ import { Link } from 'react-router-dom';
|
|||||||
import defaultApps from '~/logic/lib/default-apps';
|
import defaultApps from '~/logic/lib/default-apps';
|
||||||
|
|
||||||
import { Box } from "@tlon/indigo-react";
|
import { Box } from "@tlon/indigo-react";
|
||||||
|
const routeList = defaultApps.map(a => `/~${a}`);
|
||||||
|
|
||||||
export default class Tile extends React.Component {
|
export default class Tile extends React.Component {
|
||||||
render() {
|
render() {
|
||||||
@ -30,9 +31,16 @@ export default class Tile extends React.Component {
|
|||||||
borderRadius={2}
|
borderRadius={2}
|
||||||
borderColor="lightGray"
|
borderColor="lightGray"
|
||||||
overflow="hidden"
|
overflow="hidden"
|
||||||
|
bg={bg && "white"}
|
||||||
{...props}
|
{...props}
|
||||||
>
|
>
|
||||||
{childElement}
|
<Box
|
||||||
|
bg={bg}
|
||||||
|
height="100%"
|
||||||
|
width="100%"
|
||||||
|
>
|
||||||
|
{childElement}
|
||||||
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user