Skip to content

Commit

Permalink
feat(BrandLogo): Add file validation to logo files
Browse files Browse the repository at this point in the history
`logo.image` is now a dict of file paths, no internal reference allowed (#22)
  • Loading branch information
gadenbuie committed Sep 26, 2024
1 parent 8e857d3 commit a4d0b7c
Show file tree
Hide file tree
Showing 16 changed files with 353 additions and 115 deletions.
23 changes: 11 additions & 12 deletions examples/brand-logo-full.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
logo:
images:
primary: full-color.png
primary-svg: full-color.svg
reverse: full-color-reverse.png
black: black.png
white: white.png
icon: favicon.png
both:
light: primary
dark: reverse
small: icon
medium: both
large: primary-svg
mark: logos/pandas/pandas_mark.svg
mark-white: logos/pandas/pandas_mark_white.svg
secondary: logos/pandas/pandas_secondary.svg
secondary-white: logos/pandas/pandas_secondary_white.svg
pandas: logos/pandas/pandas.svg
pandas-white: logos/pandas/pandas_white.svg
small: mark
medium:
light: logos/pandas/pandas_secondary.svg
dark: secondary-white
large: pandas
8 changes: 4 additions & 4 deletions examples/brand-logo-light-dark.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
logo:
small: icon.png
small: logos/pandas/pandas_mark.svg
medium:
light: logo-light.png
dark: logo-dark.png
large: display.svg
light: logos/pandas/pandas_secondary.svg
dark: logos/pandas/pandas_secondary_white.svg
large: logos/pandas/pandas.svg
6 changes: 3 additions & 3 deletions examples/brand-logo-simple.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
logo:
small: icon.png
medium: logo.png
large: display.svg
small: logos/pandas/pandas_mark.svg
medium: logos/pandas/pandas_secondary.svg
large: logos/pandas/pandas.svg
1 change: 1 addition & 0 deletions examples/logos/pandas/pandas.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
111 changes: 111 additions & 0 deletions examples/logos/pandas/pandas_mark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
111 changes: 111 additions & 0 deletions examples/logos/pandas/pandas_mark_white.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions examples/logos/pandas/pandas_secondary.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions examples/logos/pandas/pandas_secondary_white.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions examples/logos/pandas/pandas_white.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 0 additions & 2 deletions pkg-py/src/brand_yaml/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@ def from_yaml(cls, path: str | Path):
"""
return cls.model_validate(read_brand_yaml(path, as_data=True))

# TODO: resolve paths relative to `brand.path`

@model_validator(mode="after")
def resolve_typography_colors(self):
if self.typography is None or self.color is None:
Expand Down
3 changes: 3 additions & 0 deletions pkg-py/src/brand_yaml/_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ def __call__(self) -> Path | HttpUrl:

return self.root

def __str__(self) -> str:
return str(self.root)

def set_root_dir(self, root_dir: Path, validate_path: bool = False) -> None:
self._root_dir = root_dir

Expand Down
Loading

0 comments on commit a4d0b7c

Please sign in to comment.